html 偽選取器與布局

來源:互聯網
上載者:User

標籤:

1、偽選取器
a:link {color: red}/* 未訪問的連結 */
a:visited {color: yellow}/* 已訪問的連結 */
a:hover {color: break} /* 滑鼠移動到連結上 */
a:active {color: green} /* 選定的連結 */
提示:在 CSS 定義中,a:hover 必須被置於 a:link 和 a:visited 之後,才是有效。
提示:在 CSS 定義中,a:active 必須被置於 a:hover 之後,才是有效。
提示:偽類名稱對大小寫不敏感。
uppercase :  轉換成大寫
lowercase :  轉換成小寫
text-decoration:none 表示連結不顯示底線

2、布局
<frameset rows="30%,*">
<frame name="top" src="top.htm" noresize="noresize"/>
<frameset cols="20%,*">
<frame name="left" src="left.htm" noresize="noresize"/>
<frame name="main" src="main.htm" noresize="noresize"/>
</frameset>
</frameset>
//noresize 讓架構不能拖動
架構頁裡不能有body。
嵌套頁面<iframe src="index.htm" width="100" height="100"></iframe>
當width="0" height="0"隱藏網頁。

3、div、css
element(元素)
元素到邊框的距離:padding(內邊距)
內邊框到邊框(border)的距離:margir(外邊距)
float 浮動
margin-right: 50px; 2個元素右邊產生間距

position :absolute 絕對位置
fixed (固定位置)產生絕對位置的元素,相對於瀏覽器視窗進行定位。
relative 相對位置(預設)
word-break:break-all; /*強制英文換行*/
overflow:auto; 溢出後,自動加捲軸

《html》<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <title></title>    <link href="css/test.css" rel="stylesheet" /></head><body>    <div id="wrap">        <div id="head">            <div id="logo">                <img src="images/11.jpg" height="50px"width=50px /></div>            <div id="menu">                <ul>                    <li>首頁</li>                    <li>部落格</li>                    <li>相簿</li>                    <li>協助</li>                </ul>            </div>        </div>        <div id="body">             <div id="nav">            <ul>                <li>good good study</li>                <li>day day up</li>                <li>known</li>                <li>so easy</li>                <li>better</li>                 </ul>             </div>            <div id="content">內容</div>        </div>        <div id="footer">著作權</div>    </div></body></html>《test.css》#body {    height:800px;    background-color:white;}#body #nav{    background-color:yellow;    width:200px;    float:left;    overflow:auto;    /*溢出後顯示捲軸*/    /*word-break:break-all; /*強制換行*/   }    #body #nav ul {    padding-top:20px;    }    #body #nav li {    list-style-type:none;    height:30px;    padding-left:30px;    }#body #concent {    background-color:green;    }

 

html 偽選取器與布局

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.