内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

面試時可能被問到的CSS問題有哪些-創(chuàng)新互聯(lián)

這篇文章主要介紹面試時可能被問到的CSS問題有哪些,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!

創(chuàng)新互聯(lián)建站專注于企業(yè)成都全網(wǎng)營銷推廣、網(wǎng)站重做改版、涼城網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、成都h5網(wǎng)站建設(shè)、商城網(wǎng)站定制開發(fā)、集團公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為涼城等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

問:

CSS選擇符有哪些?哪些屬性可以繼承?優(yōu)先級?內(nèi)聯(lián)和important哪個優(yōu)先級高?

選擇符

1通配選擇符(*)表示頁面內(nèi)所有元素的樣式*{font-size:12px;margin:0;padding:0;}
2類型選擇符(body、div、p、span等)網(wǎng)頁中已有的標(biāo)簽類型作為名稱的選擇符div{width:10px;height:10px;}
3群組選擇符(,)對一組對象同時進(jìn)行相同的樣式指派a:link,a:visited{color:#fff;}
4層次選擇符(空格)包含選擇符對某對象中的子對象進(jìn)行樣式指派#header top{width:100px;}
5id選擇符(#)id選擇符具有性,在頁面中不能重復(fù)使用#header{width:300px;}
6class選擇符(.)可以在頁面中重復(fù)使用.title{width:300px;}
7IEhack選擇符(_、*、\0、\9\0;)兼容不同的瀏覽器.title{_width:50px;*height:30px;}

可繼承的屬性

代碼如下:


azimuth, border-collapse, border-spacing,
caption-side, color, cursor, direction, elevation,
empty-cells, font-family, font-size, font-style,
font-variant, font-weight, font, letter-spacing,
line-height, list-style-image, list-style-position,
list-style-type, list-style, orphans, pitch-range,
pitch, quotes, richness, speak-header, speaknumeral,
speak-punctuation, speak, speechrate,
stress, text-align, text-indent, texttransform,
visibility, voice-family, volume, whitespace,
widows, word-spacing


優(yōu)先級的四大原則

原則1:繼承沒指定的牛B

demo1:

代碼如下:


<style type="text/css">
*{font-size:20px}
.class3{ font-size: 12px; }
</style> </p> <p><span class="class3">我是多大字號?</span> <!-- 運行結(jié)果:.class3{ font-size: 12px; }-->


demo2:

代碼如下:


<style type="text/css">
#id1 #id2{font-size:20px}
.class3{font-size:12px}
</style> </p> <p><div id="id1" class="class1">
<p id="id2" class="class2"> <span id="id3" class="class3">我是多大字號?</span> </p>
</div> <!--運行結(jié)果:.class3{ font-size: 12px; }-->


原則2:#ID > .class > 標(biāo)簽

demo1:

代碼如下:


<style type="text/css">
#id3 { font-size: 25px; }
.class3{ font-size: 18px; }
span{font-size:12px}
</style> </p> <p><span id="id3" class="class3">我是多大字號?</span> <!--運行結(jié)果:#id3 { font-size: 25px; }-->


原則3:越具體越牛B

demo1:

代碼如下:


<style type="text/css">
.class1 .class2 .class3{font-size: 25px;}
.class2 .class3{font-size:18px}
.class3 { font-size: 12px; }
</style> </p> <p><div class="class1">
<p class="class2"> <span class="class3">我是多大字號?</span> </p>
</div> <!--運行結(jié)果:.class1 .class2 .class3{font-size: 25px;}-->


原則4:標(biāo)簽#ID > 標(biāo)簽.class

demo1:

代碼如下:


<style type="text/css">
span#id3{font-size:18px}
#id3{font-size:12px}
span.class3{font-size:18px}
.class3{font-size:12px}
</style></p> <p><span id="id3">我是多大字號?</span>
<span class="class3">我是多大字號?</span> <!--運行結(jié)果:span#id3{font-size:18px} | span.class3{font-size:18px}-->


最后:當(dāng)原則之前沖突的時候,原則1 > 原則2 > 原則3 > 原則4

!important

IE6到底認(rèn)不認(rèn)識!important???

答:認(rèn)識,但是有一個小bug。

例如:

代碼如下:


<style>
#ida {size:18px}
.classb { font-size: 12px; }
</style></p> <p><div id=“ida” class=“classb”>!important測試:18px</div>


加入!important

代碼如下:


<style>
#ida{font-size:18px}
.classb{ font-size: 12px !important; }
</style></p> <p><div id=“ida” class=“classb”>!important測試:12px</div>


IE6 BUG:

代碼如下:


<style>
.classb{ font-size: 18px !important; font-size: 12px }
</style></p> <p><div class=“classA”>!important測試:12px</div>


原因和辦法:

這里在ie6下是12像素的字,而其他瀏覽器下是18px的字。

但是當(dāng)我們把樣式改一下,!important放在后面,即.classb{ font-size: 12px;font-size: 18px !important; },那么ie6下和其他瀏覽器一樣也是18px的字。

以上是“面試時可能被問到的CSS問題有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

新聞名稱:面試時可能被問到的CSS問題有哪些-創(chuàng)新互聯(lián)
轉(zhuǎn)載注明:http://www.rwnh.cn/article34/ccsspe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計、云服務(wù)器、Google、小程序開發(fā)、微信公眾號響應(yīng)式網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)
浙江省| 肇庆市| 临安市| 盱眙县| 江油市| 水富县| 当雄县| 海伦市| 长岛县| 凯里市| 高尔夫| 林西县| 石泉县| 桂阳县| 玉溪市| 武城县| 集安市| 阿合奇县| 新宁县| 延寿县| 斗六市| 安康市| 应城市| 塔河县| 丘北县| 长沙市| 崇文区| 合川市| 达日县| 黄浦区| 开鲁县| 北票市| 丹寨县| 杨浦区| 衡水市| 盐池县| 光泽县| 交口县| 化德县| 大同市| 额尔古纳市|