第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

em不設置float的話為什么會變小?

<!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=gb2312"?/>
<title>3.10新聞中心制作評測題</title>
<style?type="text/css">

/*在此定義相關CSS樣式*/
*{
????margin:0;
????padding:0;
}
.topList{
????width:310px;
????height:180px;
????border:1px?solid?#E8E8E8;
????margin:10px?auto;
????font-size:13px;??
}
.topList?ul{
????list-style-type:none;
????padding:5px;
}
.topList?li{
????margin:10px?0;
}
.topList?em{
????width:20px;
????height:16px;
????text-align:center;
????color:#333;
????font-style:normal;
????background-image:url(http://img1.sycdn.imooc.com//53cf0fa20001d3dc00200032.jpg);??
????background-position:0?-16px;
????float:left;/*這里的float不設置的話為什么會使em變小*/
}
.top?em{
????color:#FFF;
????background-position:0?0;
}
.topList?a{
????text-decoration:none;
????color:black;
}
.topList?a:hover{
????color:red;
}

</style>
</head>

<body>
<div?class="topList">
????<ul>
????????<li?class="top"><em>01</em>
????????<p><a?href="http://idcbgp.cn/"?>【慕客訪談用戶篇】“有為屌絲”在路上</a></p>
????????</li>
????????<li?class="top"><em>02</em>
????????<p><a?href="http://idcbgp.cn/">【有獎活動】給父親的三行書信</a></p>
????????</li>
????????<li?class="top"><em>03</em>
????????<p><a?href="http://idcbgp.cn/">《程序猿,請曬出你的童年》活動獲獎公告</a></p>
????????</li>
????????<li><em>04</em>
????????<p><a?href="http://idcbgp.cn/">【慕課訪談】破繭成蝶——美女程序員的蛻變史</a></p>
????????</li>
????????<li><em>05</em>
????????<p><a?href="http://idcbgp.cn/">【獲獎公告】追“球”巔峰,爭當“預言帝”</a></p>
????????</li>
????????<li><em>06</em>
????????<p><a?href="http://idcbgp.cn/">【問卷調查】慕課網用戶學習情況大調查</a></p>
????????</li>
????</ul>
</div>
</body>

如題,如果p設置display屬性為inline,那么同樣可以達到p和em在同一行。

但是em會變小,為什么?

正在回答

1 回答

首先,浮動具有破壞性,破壞了原先em的display:inline屬性;然后,浮動就是個帶有方位的display:inline-block屬性,因此設置了浮動的em,會根據width和height屬性來具體設置其大小,而沒有設置浮動的em,其大小只能由其里面的文字撐開。

1 回復 有任何疑惑可以回復我~
#1

hjh399 提問者

非常感謝!
2016-01-05 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

em不設置float的話為什么會變小?

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號