塊級元素:
> <div> <p> <form> <ul>
行級元素:
> <a> <span> <label> <button> <img> <input> <strong>
講塊級元素和行級元素 首先學習 display 這個屬性
display 屬性改變生成的框的類型,
塊級元素 默認的display屬性是 block,
行級元素 默認的display屬性是 inline,
none,為該內容不展示
所以行級元素 和 塊級元素可以通過該屬性進行切換
js查看css display:
<p id="test01"></p>
<span id="test02"> <span>
<script>
ele0 = document.getElementById("test01");
ele1 = document.getElementById("test02");
a=document.defaultView.getComputedStyle(ele0,null);
b=window.getComputedStyle(ele1 ,null); //兩種方式查看css屬性值
document.write("p:"+a.display + "--- </br>")
document.write("span:"+b.display)
</script>
https://developer.mozilla.org/zh-CN/docs/Web/API/Window/getComputedStyle