HTML DOM display屬性語法實(shí)例解析
作者:css 
  大家對CSS display屬性的用法應(yīng)該比較熟悉,這個(gè)屬性用于定義建立布局時(shí)元素生成的顯示框類型,那么HTML DOM display 屬性有何用途呢,請看本文詳細(xì)介紹。
 這里向大家描述一下HTML DOM display屬性的定義和用法,HTML DOM display屬性主要用來設(shè)置元素如何顯示,比如當(dāng)此屬性值為none時(shí),表示此元素不會(huì)被顯示,而block則表示此元素將顯示為塊級元素,此元素前后會(huì)帶有換行符。
HTML DOM display屬性定義和用法
此屬性主要用來設(shè)置元素如何顯示。
語法:
Object.style.display=value
可能的值

HTML DOM display屬性實(shí)例
本例設(shè)置不顯示元素:
- <html>
 - <head>
 - <script type="text/javascript">
 - function removeElement()
 - {
 - document.getElementById("p1").style.display="none";
 - }
 - </script>
 - </head>
 - <body>
 - <h1>Hello</h1>
 - <p id="p1">This is some text. This is some text. This is some text.
 - This is some text. This is some text. This is some text.
 - This is some text. This is some text. This is some text.</p>
 - <input type="button" onclick="removeElement()"
 - value="Do not display paragraph" />
 - </body>
 - </html>
 
【編輯推薦】
- CSS display屬性基本特性和語法
 - 探究CSS hack使用原理 規(guī)則及弊端
 - 深入探究DIV CSS布局中position屬性用法
 - CSS屬性display:inline-block使用揭秘
 - CSS hack:實(shí)現(xiàn)IE6、IE7、Firefox兼容
 
責(zé)任編輯:佚名 
                    來源:
                    w3school.com.cn
 














 
 
 
 
 
 
 