您好,都可以,都能正確的顯示,不限順序。 一般規(guī)定的順序為:font-style,font-variant,font-weight,font-size,font-family。希望能幫到您!
創(chuàng)新互聯(lián)建站是一家專注于成都網站建設、成都做網站與策劃設計,寬甸網站建設哪家好?創(chuàng)新互聯(lián)建站做網站,專注于網站建設10余年,網設計領域的專業(yè)建站公司;建站業(yè)務涵蓋:寬甸等地區(qū)。寬甸做網站價格咨詢:13518219792
要想為指定的HTML元素添加CSS樣式,首先需要選中該元素。在CSS中,執(zhí)行這一選擇操作規(guī)則部分被稱為選擇器(選擇符)。
CSS基本選擇器可以分為五類:標簽選擇器、id選擇器、類選擇器、通配符選擇器和偽類選擇器。
多類名選擇器
可以給單個標簽添加多個類名,既可以提升類樣式的復用性,也可以達到添加多種樣式的效果。在后面復雜網頁的布局中使用較多。
pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="html" cid="n2260" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit;"div class="pink fontWeight font20"蘋果/div
div class="font20"香蕉/div
div class="font14 pink"橘子/div
div class="font14"/div/pre
通配器選擇器用“*”號表示,它是所有選擇器中作用范圍最廣的,能匹配頁面中所有的元素。
常用的結構偽類選擇器:
:target 選擇器
可用于選取當前活動的目標元素,然后給它添加相應的樣式。
pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded md-focus" lang="css" cid="n2337" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 4px 6px; margin-bottom: 15px; margin-top: 15px; width: inherit;"h2a href="#brand"Brand/a/h2
div id="brand"
content for Brand
/div
background: orange;
color: #fff;
}/pre
復合選擇器是由兩個或多個基本選擇器,通過不同的方式組合而成的,目的是為了更準確、更精細的選擇目標元素標簽。
復合選擇器的三種類型:交集選擇器、并集選擇器、后代選擇器、子選擇器以及相鄰元素選擇器。
可設置的屬性(按順序): "font-style font-variant font-weight font-size/line-height font-family"
font 簡寫屬性在一個聲明中設置所有字體屬性。
font-size和font-family的值是必需的。如果缺少了其他值,默認值將被插入,如果有默認值的話。
注意: line - height屬性設置行與行之間的空間。
例子:
p.ex1{
font:15px arial,sans-serif;
}
p.ex2{
font:italic bold 12px/30px Georgia,serif;
}
擴展資料:
1、font-style:指定文本的字體樣式。
屬性值:
normal:默認值。瀏覽器顯示一個標準的字體樣式。 ?
italic:瀏覽器會顯示一個斜體的字體樣式。 ?
oblique:瀏覽器會顯示一個傾斜的字體樣式。 ?
inherit:規(guī)定應該從父元素繼承字體樣式。
2、font-variant:設置小型大寫字母的字體顯示文本,這意味著所有的小寫字母均會被轉換為大寫,但是所有使用小型大寫字體的字母與其余文本相比,其字體尺寸更小。
font-variant 屬性主要用于定義小型大寫字母文本。
屬性值:
normal:默認值。瀏覽器會顯示一個標準的字體。 ?
small-caps:瀏覽器會顯示小型大寫字母的字體。 ?
inherit:規(guī)定應該從父元素繼承 font-variant 屬性的值。 ?
3、font-weight:屬性設置文本的粗細。
屬性值:
normal:默認值。定義標準的字符。 ?
bold:定義粗體字符。 ?
bolder:定義更粗的字符。 ?
lighter:定義更細的字符。 ?
100-900的整百數(shù):定義由粗到細的字符。400 等同于 normal,而 700 等同于 bold。 ?
inherit:規(guī)定應該從父元素繼承字體的粗細。
4、font-size:屬性用于設置字體大小。 ?
5、font - family:屬性指定一個元素的字體。
當前題目:css復合樣式,復選框樣式css
當前路徑:http://chinadenli.net/article46/dsdephg.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供響應式網站、外貿建站、定制網站、品牌網站建設、標簽優(yōu)化、企業(yè)網站制作
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)