首页 > 代码库 > 【css】float:left不撑满容器与opacity将子元素透明demo

【css】float:left不撑满容器与opacity将子元素透明demo

<!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" xml:lang="en"><head>    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">    <title>Document</title>    <style type="text/css">    ul,li{ list-style: none; margin: 0; padding:0;}    .parent{ background-color: red; opacity: 0.5; filter:alpha(opacity=50); overflow: hidden; zoom:1;}    ul.ullist li{ float:left;}    </style></head><body>    <div class=‘parent‘>        <ul class=‘ullist‘>            <li>首页</li><li>热门</li><li>应用</li><li>游戏</li><li>短信</li>        </ul>    </div></body></html>

//浮动元素不占据空间