標籤:inpu value hover isp title css選取器 nbsp 12px visit
css選取器
css與html的關係 css以html為基礎css主要設定的就是html標籤中的屬性樣式,css進行網頁布局。
css文法選取器{屬性:值,屬性:值}
css選取器 基本選取器
*{margin:0; padding:0}網頁中所以的標配都可以用p{ font-size:2px }標籤選取器.input{background:#ffo}p.info{background:red} p下面類名是info的標籤#footer{ background:red; }p#info{ background:red; }p下面id是#info的標籤
多元素選取器
div,p{ color:#f00 }多元素選取器ul li{ display:inline;}後代選取器ul>li{ displa:inline; }子項目選取器div+p{ color:#f00;}毗鄰元素選取器
屬性選取器
E[att]<style> div[title]{ color:red }</style><div title="哈哈"></div><div class="acb"></div>命中第一個div,
E[att=val]
<style> div[class*="b"]{ color:red } input[type="text"]{ foot:12px; }</style>
命中所有div,因為匹配到了class屬性,屬性值都包含了b<div class="abc"></div><div class="acb"></div>
只匹配第一個input<input type="text" name="Name"/><input type="button" name="Name"/>
偽類別選取器
p:frist-child{ font:12px } 匹配父元素第一個子項目
a:link{ color:red; }/* 未被訪問的連結 */a:visited{color:red }/* 已被訪問的連結 */a:hover{ color:red;}/* 滑鼠指標移動到連結上 */a:active{ color: red;}/* 正在被點擊的連結 */
style type="text/css"> input[type=text]:focus { background:red; color:#fff}</style>
<body> <input type="text" value="skss" /></body>匹配獲得當前焦點的元素
<style> p:before{ content:‘台詞‘};</style><p>開始</p>//台詞開始 在E元素之前插入產生的內容
<style> p:after{ content:‘台詞‘}</style><p>開始</p>//開始台詞 在E元素之後插入產生的內容
html基礎(選取器,font屬性 )