<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # CSS 分類 (Classification) **CSS 分類屬性允許你規定如何以及在何處顯示元素。** ## CSS分類(Classification)實例: [如何把元素顯示為內聯元素](/tiy/t.asp?f=csse_display) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; p {display: inline} div {display: none} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;本例中的樣式表把段落元素設置為內聯元素。&lt;/p&gt; &lt;p&gt;而 div 元素不會顯示出來!&lt;/p&gt; &lt;div&gt;div 元素的內容不會顯示出來!&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; ``` [如何把元素顯示為塊級元素](/tiy/t.asp?f=csse_display_block) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; span { display: block } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;span&gt;本例中的樣式表把 span 元素設置為塊級元素。&lt;/span&gt; &lt;span&gt;兩個 span 元素之間產生了一個換行行為。&lt;/span&gt; &lt;/body&gt; &lt;/html&gt; ``` [float 屬性的簡單應用](/tiy/t.asp?f=csse_float) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; img { float:right } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;在下面的段落中,我們添加了一個樣式為 &lt;b&gt;float:right&lt;/b&gt; 的圖像。結果是這個圖像會浮動到段落的右側。&lt;/p&gt; &lt;p&gt; &lt;img src="/i/eg_cute.gif" /&gt; 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. 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. 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. This is some text. This is some text. This is some text. &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; ``` [將帶有邊框和邊界的圖像浮動于段落的右側](/tiy/t.asp?f=csse_float2) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; img { float:right; border:1px dotted black; margin:0px 0px 15px 20px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;在下面的段落中,圖像會浮動到右側,并且添加了點狀的邊框。我們還為圖像添加了邊距,這樣就可以把文本推離圖像:上和右外邊距是 0px,下外邊距是 15px,而圖像左側的外邊距是 20px。&lt;/p&gt; &lt;p&gt; &lt;img src="/i/eg_cute.gif" /&gt; 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. 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. 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. This is some text. This is some text. This is some text. &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; ``` [帶標題的圖像浮動于右側](/tiy/t.asp?f=csse_float3) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; div { float:right; width:120px; margin:0 0 15px 20px; padding:15px; border:1px solid black; text-align:center; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;img src="/i/eg_cute.gif" /&gt;&lt;br /&gt; CSS is fun! &lt;/div&gt; &lt;p&gt; 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. 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. 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. 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. This is some text. This is some text. This is some text. &lt;/p&gt; &lt;p&gt; 在上面的段落中,div 元素的寬度是 120 像素,它其中包含圖像。div 元素浮動到右側。我們向 div 元素添加了外邊距,這樣就可以把 div 推離文本。同時,我們還向 div 添加了邊框和內邊距。 &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; ``` [使段落的首字母浮動于左側](/tiy/t.asp?f=csse_float4) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; span { float:left; width:0.7em; font-size:400%; font-family:algerian,courier; line-height:80%; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt; &lt;span&gt;T&lt;/span&gt;his 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. 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. This is some text. This is some text. This is some text. &lt;/p&gt; &lt;p&gt; 在上面的段落中,文本的第一個字母包含在一個 span 元素中。這個 span 元素的寬度是當前字體尺寸的 0.7 倍。span 元素的字體尺寸是 400%,行高是 80%。span 中的字母字體是 "Algerian" &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; ``` [創建水平菜單](/tiy/t.asp?f=csse_float5) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; ul { float:left; width:100%; padding:0; margin:0; list-style-type:none; } a { float:left; width:7em; text-decoration:none; color:white; background-color:purple; padding:0.2em 0.6em; border-right:1px solid white; } a:hover {background-color:#ff3300} li {display:inline} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Link one&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link two&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link three&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link four&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;p&gt; 在上面的例子中,我們把 ul 元素和 a 元素浮向左浮動。li 元素顯示為行內元素(元素前后沒有換行)。這樣就可以使列表排列成一行。ul 元素的寬度是 100%,列表中的每個超鏈接的寬度是 7em(當前字體尺寸的 7 倍)。我們添加了顏色和邊框,以使其更漂亮。 &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; ``` [創建無表格的首頁](/tiy/t.asp?f=csse_float6) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; div.container { width:100%; margin:0px; border:1px solid gray; line-height:150%; } div.header,div.footer { padding:0.5em; color:white; background-color:gray; clear:left; } h1.header { padding:0; margin:0; } div.left { float:left; width:160px; margin:0; padding:1em; } div.content { margin-left:190px; border-left:1px solid gray; padding:1em; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container"&gt; &lt;div class="header"&gt;&lt;h1 class="header"&gt;W3School.com.cn&lt;/h1&gt;&lt;/div&gt; &lt;div class="left"&gt;&lt;p&gt;"Never increase, beyond what is necessary, the number of entities required to explain anything." William of Ockham (1285-1349)&lt;/p&gt;&lt;/div&gt; &lt;div class="content"&gt; &lt;h2&gt;Free Web Building Tutorials&lt;/h2&gt; &lt;p&gt;At W3School.com.cn you will find all the Web-building tutorials you need, from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.&lt;/p&gt; &lt;p&gt;W3School.com.cn - The Largest Web Developers Site On The Net!&lt;/p&gt;&lt;/div&gt; &lt;div class="footer"&gt;Copyright 2008 by YingKe Investment.&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; ``` [定位:相對定位](/tiy/t.asp?f=csse_position_relative) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; h2.pos_left { position:relative; left:-20px } h2.pos_right { position:relative; left:20px } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;這是位于正常位置的標題&lt;/h2&gt; &lt;h2 class="pos_left"&gt;這個標題相對于其正常位置向左移動&lt;/h2&gt; &lt;h2 class="pos_right"&gt;這個標題相對于其正常位置向右移動&lt;/h2&gt; &lt;p&gt;相對定位會按照元素的原始位置對該元素進行移動。&lt;/p&gt; &lt;p&gt;樣式 "left:-20px" 從元素的原始左側位置減去 20 像素。&lt;/p&gt; &lt;p&gt;樣式 "left:20px" 向元素的原始左側位置增加 20 像素。&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; ``` [定位:絕對定位](/tiy/t.asp?f=csse_position_absolute) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; h2.pos_abs { position:absolute; left:100px; top:150px } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h2 class="pos_abs"&gt;這是帶有絕對定位的標題&lt;/h2&gt; &lt;p&gt;通過絕對定位,元素可以放置到頁面上的任何位置。下面的標題距離頁面左側 100px,距離頁面頂部 150px。&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; ``` [定位:固定定位](/tiy/t.asp?f=csse_position_fixed) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; p.one { position:fixed; left:5px; top:5px; } p.two { position:fixed; top:30px; right:5px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;p class="one"&gt;一些文本。&lt;/p&gt; &lt;p class="two"&gt;更多的文本。&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; ``` [如何使元素不可見](/tiy/t.asp?f=csse_visibility) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; h1.visible {visibility:visible} h1.invisible {visibility:hidden} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h1 class="visible"&gt;這是可見的標題&lt;/h1&gt; &lt;h1 class="invisible"&gt;這是不可見的標題&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; ``` [把表格元素設置為 collapse(請在非 IE 的瀏覽器中查看)](/tiy/t.asp?f=csse_visibility_collapse) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; tr.coll { visibility:collapse } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;table border="1"&gt; &lt;tr&gt; &lt;td&gt;Adams&lt;/td&gt; &lt;td&gt;John&lt;/td&gt; &lt;/tr&gt; &lt;tr class="coll"&gt; &lt;td&gt;Bush&lt;/td&gt; &lt;td&gt;George&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; ``` [改變光標](/tiy/t.asp?f=csse_cursor) ``` &lt;html&gt; &lt;body&gt; &lt;p&gt;請把鼠標移動到單詞上,可以看到鼠標指針發生變化:&lt;/p&gt; &lt;span style="cursor:auto"&gt; Auto&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:crosshair"&gt; Crosshair&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:default"&gt; Default&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:pointer"&gt; Pointer&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:move"&gt; Move&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:e-resize"&gt; e-resize&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:ne-resize"&gt; ne-resize&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:nw-resize"&gt; nw-resize&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:n-resize"&gt; n-resize&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:se-resize"&gt; se-resize&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:sw-resize"&gt; sw-resize&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:s-resize"&gt; s-resize&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:w-resize"&gt; w-resize&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:text"&gt; text&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:wait"&gt; wait&lt;/span&gt;&lt;br /&gt; &lt;span style="cursor:help"&gt; help&lt;/span&gt; &lt;/body&gt; &lt;/html&gt; ``` [清除元素的側面](/tiy/t.asp?f=csse_class-clear) ``` &lt;html&gt; &lt;head&gt; &lt;style type="text/css"&gt; img { float:left; clear:both; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;img src="/i/eg_smile.gif" /&gt; &lt;img src="/i/eg_smile.gif" /&gt; &lt;/body&gt; &lt;/html&gt; ``` ## CSS 分類屬性 (Classification) CSS 分類屬性允許你控制如何顯示元素,設置圖像顯示于另一元素中的何處,相對于其正常位置來定位元素,使用絕對值來定位元素,以及元素的可見度。 | 屬性 | 描述 | | --- | --- | | [clear](/cssref/pr_class_clear.asp "CSS clear 屬性") | 設置一個元素的側面是否允許其他的浮動元素。 | | [cursor](/cssref/pr_class_cursor.asp "CSS cursor 屬性") | 規定當指向某元素之上時顯示的指針類型。 | | [display](/cssref/pr_class_display.asp "CSS display 屬性") | 設置是否及如何顯示元素。 | | [float](/cssref/pr_class_float.asp "CSS float 屬性") | 定義元素在哪個方向浮動。 | | [position](/cssref/pr_class_position.asp "CSS position 屬性") | 把元素放置到一個靜態的、相對的、絕對的、或固定的位置中。 | | [visibility](/cssref/pr_class_visibility.asp "CSS visibility 屬性") | 設置元素是否可見或不可見。 |
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看