CSS display:inline-block 語法
display:inline-block;
inline-block 為 display 屬性的其中一個參數,所以語法與其它 display 屬性的用法相同。CSS display:inline-block 區塊水平排列的範例語法
<style type="text/css">
<!--
#DIV_A{
float:left;
width:200px;
height:50px;
border:2px blue solid;
margin-right:10px;
margin-bottom:10px;
}
#DIV_B {
width:100%;
height:10px;
border:2px orange solid;
}
#DIV_C{
display:inline-block;
width:200px;
height:50px;
border:2px blue solid;
margin-right:10px;
margin-bottom:10px;
}
#DIV_D {
width:100%;
height:10px;
border:2px orange solid;
}
-->
</style>
<div id="DIV_A"></div>
<div id="DIV_A"></div>
<div id="DIV_A"></div>
<div id="DIV_B"></div>
<div style="clear:both;"></div>
<div id="DIV_C"></div>
<div id="DIV_C"></div>
<div id="DIV_C"></div>
<div id="DIV_D"></div>
範例的效果<!--
#DIV_A{
float:left;
width:200px;
height:50px;
border:2px blue solid;
margin-right:10px;
margin-bottom:10px;
}
#DIV_B {
width:100%;
height:10px;
border:2px orange solid;
}
#DIV_C{
display:inline-block;
width:200px;
height:50px;
border:2px blue solid;
margin-right:10px;
margin-bottom:10px;
}
#DIV_D {
width:100%;
height:10px;
border:2px orange solid;
}
-->
</style>
<div id="DIV_A"></div>
<div id="DIV_A"></div>
<div id="DIV_A"></div>
<div id="DIV_B"></div>
<div style="clear:both;"></div>
<div id="DIV_C"></div>
<div id="DIV_C"></div>
<div id="DIV_C"></div>
<div id="DIV_D"></div>
閱讀更多網頁排版的技巧