父容器定宽,ul不定宽,li不折行

来源:互联网 发布:通用汽车dps编程软件 编辑:程序博客网 时间:2024/05/16 17:46

做水平滚动轮播时的思考。

ul宽度不会被撑开,但scrollwidth会撑开。

<html><head>    <title>test-li不折行</title>    <meta charset="gbk" />    <style type="text/css">        ul{ white-space: nowrap; padding: 0; margin: 0; overflow: auto;}        li{ width: 900px; height: 200px; background-color: green; display: inline-block;}    </style></head><body>    <div style="width: 900px; height: 200px; margin: 0 auto; overflow: hidden;">        <ul>            <li></li>            <li></li>            <li></li>            <li></li>        </ul>    </div></body></html>

 


<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击