Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 国产精选第一页,欧美视频www,91成人在线播放

          整合營銷服務(wù)商

          電腦端+手機(jī)端+微信端=數(shù)據(jù)同步管理

          免費(fèi)咨詢熱線:

          簡單了解CSS3的all屬性

          簡單了解CSS3的all屬性

          者:張鑫旭(@張鑫旭)

          網(wǎng)址:http://www.zhangxinxu.com/wordpress/2016/03/know-about-css3-all/

          一、兼容性

          一些CSS文章,或者CSS文檔,兼容性什么的都是放在最后。

          又不是什么見不得人的事情,來,直接開篇就亮刺刀。

          兼容性還行, 除了IE不支持,其他瀏覽器基本上都綠油油,目前自娛自樂,內(nèi)網(wǎng)項目什么的都是可以用用的。

          二、all是干嘛用的

          all屬性實際上是所有CSS屬性的縮寫,表示,所有的CSS屬性都怎樣怎樣,但是,不包括unicode-bidi和direction這兩個CSS屬性。

          為什么會有這個CSS屬性呢?

          我們可能知道,有些CSS屬性值基本上所有CSS屬性都有,比方說繼承inherit!

          我們CSS reset輸入框的時候,是不是有類似這樣的代碼(實際可能是具體值,作用類似):

          input, textarea {

          color: inherit;

          font-size: inherit;

          font-family: inherit;

          }

          因為這類輸入控件自身有內(nèi)置的大小和字體,需要重置。

          此時,大家就會發(fā)現(xiàn),這些屬性值都是inherit, 要是可以合并就好了!

          喲喲喲,說到點(diǎn)子上了,CSS all屬性就是用來合并的。

          input, textarea {

          all: inherit;

          }

          喔噢,三合一,頓時一陣春風(fēng)拂面之感。但是,這里僅僅是展示作用,實際上是不會這么用的,因為,all:inherit會讓背景色什么的,都繼承父級,相信這不是你希望看到的。

          三、語法和區(qū)別

          語法如下:

          all: initial;

          all: inherit;

          all: unset;

          /* CSS4特性,無視之 */

          all: revert;

          支持三個CSS通用屬性值,initial, inherit, unset. 這三個屬性值分別表示什么意思呢?

          您可以狠狠地點(diǎn)擊這里:CSS3 all屬性演示demo(http://www.zhangxinxu.com/study/201603/css3-all.html)

          默認(rèn)的HTML和CSS是這樣的,一個傳統(tǒng)的標(biāo)簽內(nèi)容,有標(biāo)題有列表:

          <article>

          <h6>標(biāo)題</h6>

          <p>p變文字</p>

          <ol>

          <li>有序列表1</li>

          <li>有序列表2</li>

          <li>有序列表3</li>

          </ol>

          <textarea>文本域</textarea>

          </article>

          article {

          background-color: #f0f3f9;

          color: green;

          }

          article > textarea {

          border: 1px solid #34538b;

          background-color: #ffffe0;

          color: red;

          }

          這盛世,如你所見:

          顏色啊,間距啊,以及文本域狀態(tài)都是我們認(rèn)為的樣子顯示。

          現(xiàn)在,點(diǎn)擊demo的下拉,選擇對應(yīng)的all屬性值,實現(xiàn)下面CSS效果:

          .initial > * {

          all: initial;

          }

          .inherit > * {

          all: inherit;

          }

          .unset > * {

          all: unset;

          }

          結(jié)果:

          • initial

          initial是初始值的意思,也就是,article元素下面所有的第一級子元素都除了unicode-bidi和direction以外的CSS都使用初始值。

          例如,<h6>, <p>元素瀏覽器內(nèi)置的display:block直接拜拜了,都變成了inline元素,因此在一行顯示:

          font-size也使用了瀏覽器軟件本身設(shè)置的大小16px,color顏色也變成了瀏覽器軟件本身的黑色。例如,在瀏覽器設(shè)置中改變字號,從中變成大:

          會看到顯示的文字內(nèi)容也變大了:

          由于我們只是對相鄰層級子元素進(jìn)行了initial設(shè)置,因此,<li>元素不受影響,但是,由于在父元素不明的情況下,<li>元素的默認(rèn)是打點(diǎn),因此,這里從數(shù)字變成了點(diǎn),list-style-type和list-style-position都變化了。

          • inherit

          inherit是繼承的意思,也就是,article元素下面所有的相鄰子元素都除了unicode-bidi和direction以外的CSS都繼承了<article>元素的CSS。

          因此,<h6>, <p>元素還是塊狀的,background-color都是<article>元素的背景色,color顏色也跟<article>一樣,是綠色(文本域的紅色被干掉了)。

          不僅上面這些CSS,padding/margin也都繼承了,只是默認(rèn)是0, 看不出來,我們稍微修改下,例如給<article>元素來個margin值:

          結(jié)果,那些子元素都開花了:

          • unset

          unset是取消設(shè)置的意思,也就是,article元素下面所有的相鄰子元素除了unicode-bidi和direction以外的CSS都干掉都不要,不要了那用什么呢?unset值的特性如下,當(dāng)前元素瀏覽器或用戶設(shè)置的CSS忽略,然后如果是具有繼承特性的CSS,如color, 則使用繼承值;如果是沒有繼承特性的CSS屬性,如background-color, 則使用初始值。

          因此,<h6>, <p>元素的display屬性值使用了initial初始值,因此變成了inline元素,兩個同一行顯示了;而這些元素的color顏色使用了inherit繼承值,因此都是綠色,<textarea>的背景色background-color不具有繼承特性,因此使用的是initial初始值,也就是transparent透明,因此,就是截圖所示效果。

          三、結(jié)語

          動手寫文章之前,還以為這個CSS屬性會有意想不到的妙用,最后結(jié)果是,表現(xiàn)確實意想不到,至于妙用,我只能科科一下。

          all所牽扯的CSS實在是太多了,我目前還是想不出有什么場景,就是要用這個CSS屬性。或者說什么時候,希望特殊的元素一下子變成普通元素,例如,input輸入框外面一個div,來個input{all:inherit;},貌似還真有這樣的場景,輸入框不需要border不需要background不需要padding不需要margin, 恩,不錯,不枉寫此文了!

          更多精彩內(nèi)容在微信公眾平臺:網(wǎng)頁設(shè)計自學(xué)平臺

          干貨!免費(fèi)領(lǐng)取Adobe高級講師前端教程


          點(diǎn)我領(lǐng)取


          者:YGYOO

          轉(zhuǎn)發(fā)鏈接:https://juejin.im/post/5b8905456fb9a01a105966b4

          、定義

          <meta> 標(biāo)簽提供關(guān)于 HTML 文檔的元數(shù)據(jù)。它不會顯示在頁面上,但是對于機(jī)器是可讀的。可用于瀏覽器(如何顯示內(nèi)容或重新加載頁面),搜索引擎(關(guān)鍵詞),或其他 web 服務(wù)。

          2、作用

          meta里的數(shù)據(jù)是供機(jī)器解讀的,告訴機(jī)器該如何解析這個頁面,還有一個用途是可以添加服務(wù)器發(fā)送到瀏覽器的http頭部內(nèi)容,例如我們?yōu)轫撁嬷刑砑尤缦耺eta標(biāo)簽:


          1. <meta http-equiv="charset" content="iso-8859-1">
          2. <meta http-equiv="expires" content="31 Dec 2008">

          瀏覽器的頭部就會包括這些:


          1. charset:iso-8859-1
          2. expires:31 Dec 2008

          只有瀏覽器可以接受這些附加的頭部字段,并能以適當(dāng)?shù)姆绞绞褂盟鼈儠r,這些字段才有意義。

          3、meta的必需屬性和可選屬性

          meta的必需屬性是content,當(dāng)然并不是說meta標(biāo)簽里一定要有content,而是當(dāng)有http-equiv或name屬性的時候,一定要有content屬性對其進(jìn)行說明。例如:

          必需屬性

          <meta name="keywords" content="HTML,ASP,PHP,SQL">

          這里面content里的屬性就是對keywords進(jìn)行的說明,所以呢也可以理解成一個鍵值對吧,就是{keywords:"HTML,ASP,PHP,SQL"}。

          可選屬性

          在W3school中,對于meta的可選屬性說到了三個,分別是http-equiv、name和scheme。考慮到scheme不是很常用,所以就只說下前兩個屬性吧。

          http-equiv

          http-equiv屬性是添加http頭部內(nèi)容,對一些自定義的,或者需要額外添加的http頭部內(nèi)容,需要發(fā)送到瀏覽器中,我們就可以是使用這個屬性。在上面的meta作用中也有簡單的說明,那么現(xiàn)在再舉個例子。例如我們不想使用js來重定向,用http頭部內(nèi)容控制,那么就可以這樣控制:

          <meta http-equiv="Refresh" content="5;url=http://blog.yangchen123h.cn" />

          在頁面中加入這個后,5秒鐘后就會跳轉(zhuǎn)到指定頁面啦,效果可看W3school的例子

          name

          第二個可選屬性是name,這個屬性是供瀏覽器進(jìn)行解析,對于一些瀏覽器兼容性問題,name屬性是最常用的,當(dāng)然有個前提就是瀏覽器能夠解析你寫進(jìn)去的name屬性才可以,不然就是沒有意義的。還是舉個例子吧:

          <meta name="renderer" content="webkit">

          這個meta標(biāo)簽的意思就是告訴瀏覽器,用webkit內(nèi)核進(jìn)行解析,當(dāng)然前提是瀏覽器有webkit內(nèi)核才可以,不然就是沒有意義的啦。當(dāng)然看到這個你可能會有疑問,這個renderer是從哪里冒出來的,我要怎么知道呢?這個就是在對應(yīng)的瀏覽器的開發(fā)文檔里就會有表明的,例如這個renderer是在360瀏覽器里說明的。360瀏覽器內(nèi)核控制Meta標(biāo)簽說明文檔

          常用meta標(biāo)簽大總結(jié)

          接下來就是常用的meta標(biāo)簽大總結(jié)啦,我會盡可能的做到全

          charset

          charset是聲明文檔使用的字符編碼,解決亂碼問題主要用的就是它,值得一提的是,這個charset一定要寫第一行,不然就可能會產(chǎn)生亂碼了。

          charset有兩種寫法


          1. <meta charset="utf-8">
          2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

          兩個都是等效的。

          百度禁止轉(zhuǎn)碼

          百度會自動對網(wǎng)頁進(jìn)行轉(zhuǎn)碼,這個標(biāo)簽是禁止百度的自動轉(zhuǎn)碼

          <meta http-equiv="Cache-Control" content="no-siteapp" />

          SEO 優(yōu)化部分


          1. <!-- 頁面標(biāo)題<title>標(biāo)簽(head 頭部必須) -->
          2. <title>your title</title>
          3. <!-- 頁面關(guān)鍵詞 keywords -->
          4. <meta name="keywords" content="your keywords">
          5. <!-- 頁面描述內(nèi)容 description -->
          6. <meta name="description" content="your description">
          7. <!-- 定義網(wǎng)頁作者 author -->
          8. <meta name="author" content="author,email address">
          9. <!-- 定義網(wǎng)頁搜索引擎索引方式,robotterms 是一組使用英文逗號「,」分割的值,通常有如下幾種取值:none,noindex,nofollow,all,index和follow。 -->
          10. <meta name="robots" content="index,follow">

          viewport

          viewport主要是影響移動端頁面布局的,例如:


          1. <meta name="viewport" content="width=device-width, initial-scale=1.0">

          content 參數(shù):

          • width viewport 寬度(數(shù)值/device-width)
          • height viewport 高度(數(shù)值/device-height)
          • initial-scale 初始縮放比例
          • maximum-scale 最大縮放比例
          • minimum-scale 最小縮放比例
          • user-scalable 是否允許用戶縮放(yes/no)

          各瀏覽器平臺

          Microsoft Internet Explorer


          1. <!-- 優(yōu)先使用最新的ie版本 -->
          2. <meta http-equiv="x-ua-compatible" content="ie=edge">
          3. <!-- 是否開啟cleartype顯示效果 -->
          4. <meta http-equiv="cleartype" content="on">
          5. <meta name="skype_toolbar" content="skype_toolbar_parser_compatible">
          6. <!-- Pinned Site -->
          7. <!-- IE 10 / Windows 8 -->
          8. <meta name="msapplication-TileImage" content="pinned-tile-144.png">
          9. <meta name="msapplication-TileColor" content="#009900">
          10. <!-- IE 11 / Windows 9.1 -->
          11. <meta name="msapplication-config" content="ieconfig.xml">

          Google Chrome


          1. <!-- 優(yōu)先使用最新的chrome版本 -->
          2. <meta http-equiv="X-UA-Compatible" content="chrome=1" />
          3. <!-- 禁止自動翻譯 -->
          4. <meta name="google" value="notranslate">

          360瀏覽器


          1. <!-- 選擇使用的瀏覽器解析內(nèi)核 -->
          2. <meta name="renderer" content="webkit|ie-comp|ie-stand">

          UC手機(jī)瀏覽器

          UCBrowser_U3_API

          QQ手機(jī)瀏覽器


          1. <!-- 鎖定屏幕在特定方向 -->
          2. <meta name="x5-orientation" content="landscape/portrait">
          3. <!-- 全屏顯示 -->
          4. <meta name="x5-fullscreen" content="true">
          5. <!-- 頁面將以應(yīng)用模式顯示 -->
          6. <meta name="x5-page-mode" content="app">

          Apple iOS


          1. <!-- Smart App Banner -->
          2. <meta name="apple-itunes-app" content="app-id=APP_ID,affiliate-data=AFFILIATE_ID,app-argument=SOME_TEXT">
          3. <!-- 禁止自動探測并格式化手機(jī)號碼 -->
          4. <meta name="format-detection" content="telephone=no">
          5. <!-- Add to Home Screen添加到主屏 -->
          6. <!-- 是否啟用 WebApp 全屏模式 -->
          7. <meta name="apple-mobile-web-app-capable" content="yes">
          8. <!-- 設(shè)置狀態(tài)欄的背景顏色,只有在 “apple-mobile-web-app-capable” content=”yes” 時生效 -->
          9. <meta name="apple-mobile-web-app-status-bar-style" content="black">
          10. <!-- 添加到主屏后的標(biāo)題 -->
          11. <meta name="apple-mobile-web-app-title" content="App Title">

          Google Android


          1. <meta name="theme-color" content="#E64545">
          2. <!-- 添加到主屏 -->
          3. <meta name="mobile-web-app-capable" content="yes">
          4. <!-- More info: https://developer.chrome.com/multidevice/android/installtohomescreen -->

          App Links


          1. <!-- iOS -->
          2. <meta property="al:ios:url" content="applinks://docs">
          3. <meta property="al:ios:app_store_id" content="12345">
          4. <meta property="al:ios:app_name" content="App Links">
          5. <!-- Android -->
          6. <meta property="al:android:url" content="applinks://docs">
          7. <meta property="al:android:app_name" content="App Links">
          8. <meta property="al:android:package" content="org.applinks">
          9. <!-- Web Fallback -->
          10. <meta property="al:web:url" content="http://applinks.org/documentation">
          11. <!-- More info: http://applinks.org/documentation/ -->

          最后——移動端常用的meta


          1. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
          2. <meta name="apple-mobile-web-app-capable" content="yes" />
          3. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
          4. <meta name="format-detection"content="telephone=no, email=no" />
          5. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
          6. <meta name="apple-mobile-web-app-capable" content="yes" /><!-- 刪除蘋果默認(rèn)的工具欄和菜單欄 -->
          7. <meta name="apple-mobile-web-app-status-bar-style" content="black" /><!-- 設(shè)置蘋果工具欄顏色 -->
          8. <meta name="format-detection" content="telphone=no, email=no" /><!-- 忽略頁面中的數(shù)字識別為電話,忽略email識別 -->
          9. <!-- 啟用360瀏覽器的極速模式(webkit) -->
          10. <meta name="renderer" content="webkit">
          11. <!-- 避免IE使用兼容模式 -->
          12. <meta http-equiv="X-UA-Compatible" content="IE=edge">
          13. <!-- 針對手持設(shè)備優(yōu)化,主要是針對一些老的不識別viewport的瀏覽器,比如黑莓 -->
          14. <meta name="HandheldFriendly" content="true">
          15. <!-- 微軟的老式瀏覽器 -->
          16. <meta name="MobileOptimized" content="320">
          17. <!-- uc強(qiáng)制豎屏 -->
          18. <meta name="screen-orientation" content="portrait">
          19. <!-- QQ強(qiáng)制豎屏 -->
          20. <meta name="x5-orientation" content="portrait">
          21. <!-- UC強(qiáng)制全屏 -->
          22. <meta name="full-screen" content="yes">
          23. <!-- QQ強(qiáng)制全屏 -->
          24. <meta name="x5-fullscreen" content="true">
          25. <!-- UC應(yīng)用模式 -->
          26. <meta name="browsermode" content="application">
          27. <!-- QQ應(yīng)用模式 -->
          28. <meta name="x5-page-mode" content="app">
          29. <!-- windows phone 點(diǎn)擊無高光 -->
          30. <meta name="msapplication-tap-highlight" content="no">
          31. <!-- 適應(yīng)移動端end -->

          主站蜘蛛池模板: 波多野结衣一区在线| 亚洲综合在线成人一区| 亚洲国产欧美日韩精品一区二区三区 | 任你躁国语自产一区在| 国产一区高清视频| 日本高清一区二区三区| 亚洲电影唐人社一区二区| 日本一区二区免费看| 99久久精品国产免看国产一区| 色欲精品国产一区二区三区AV| 国产在线精品一区二区三区不卡 | 国产一区二区三区乱码在线观看| 中文字幕亚洲一区二区va在线| 在线观看视频一区二区| 中文精品一区二区三区四区 | 久久久久人妻一区精品| 四虎一区二区成人免费影院网址| 亚洲精品色播一区二区| 国模私拍福利一区二区| 91无码人妻精品一区二区三区L| 日韩人妻无码一区二区三区久久| 国产成人精品一区二区秒拍| 免费精品一区二区三区第35| 精品福利一区二区三| 日本不卡在线一区二区三区视频| 无码国产精成人午夜视频一区二区| 中文字幕VA一区二区三区| 国产人妖视频一区二区| 无码精品人妻一区二区三区中| 一区二区免费视频| 中文字幕av人妻少妇一区二区| 在线免费观看一区二区三区| 精品一区二区AV天堂| 一区二区三区免费视频观看| 中文字幕在线观看一区二区| 99精品国产一区二区三区不卡| 亚洲一区二区三区久久| 日韩AV片无码一区二区不卡| 亚洲福利精品一区二区三区| 中文字幕一区二区三区在线播放| 秋霞午夜一区二区|