2018-08-14 HTML5空白標(biāo)簽

html中標(biāo)簽分為兩大類:
1.塊級標(biāo)簽:一行只能有一個(不管標(biāo)簽的寬度是多少)
h1-h6, p, hr, 列表標(biāo)簽,table, form,

2.行內(nèi)標(biāo)簽:一行可以有多個
a, img, input,下拉列表(select), textarea

div標(biāo)簽,是空白標(biāo)簽,沒有任何特殊的意義(無語義標(biāo)簽)

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        
        <div id="">
            <a href="">百度一下</a>
        </div>
        <div id="">
            <a href="">淘寶</a>
        </div>
        
        <div style="background-color: red; width: 100px;">
            我是div1 <br />
            我是div111
        </div>
        <span style="background-color: royalblue;">
            我是span4
        </span>
        <div style="background-color: yellow; width: 90px;">
            我是div2
        </div>
        <div style="background-color: palevioletred; width: 120px;">
            我是div3
        </div>
        
        <span style="background-color: green;">
            我是span
        </span>
        <span style="background-color: gold;">
            我是span2
        </span>
        <span style="background-color: greenyellow;">
            我是span3
        </span>
        <span style="background-color: royalblue;">
            我是span4
        </span>

    </body>
</html>
空白標(biāo)簽

可以看出,div是占用整一行,而span的長度隨內(nèi)容長度而定

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容