關鍵樣式:
white-space:nowrap;/*內容橫向排列不換行*/
overflow-x:auto; overflow-y:hidden;/*隱藏溢出部分。橫向捲軸自動出現,縱向捲軸隱藏*/
預覽程式碼:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns=" http://www.w3.org/1999/xhtml ">
<head>
<meta. http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>css實現圖片橫向排列,溢出隱藏橫向滾動</title>
<style. type="text/css">
<!--
.inimg {width:670px;height:395px;white-space:nowrap;overflow-x:auto;overflow-y:hidden;}
.inimg img {width:670px;height:375px;}
-->
</style>
</head>
<body>
<div class="inimg">
<img src=" " width="670" height="375" alt="img" />
<img src=" " width="670" height="375" alt="img" />
<img src=" " width="670" height="375" alt="img" />
<img src=" " width="670" height="375" alt="img" />
</div>
</body>
</html>