報告翻譯推薦

 選擇器 #」界說 id ,類型使用 <a href="#"> 一般超保持 </a><a id="x_hint" href="#"> Hint 超貫穿連接 </a>

a[critical] {  background-color: yellow; }

上面兩個看起來都是在設定當 p 在 div 區塊內時 設定其 CSS 樣式,但不同在
div p {} 會將 div 區塊下的所有 p 區塊都套用
div > p {} 只會將 div 區塊下的直接的 p 區塊套用,意即 p 區塊假如再被包在 strong 區塊內的話,就不會被套用

選擇器 [attribute=value] ,例如 當超保持是以開新視窗 target=_blank 方式開啟就套用粗體

 選擇器 「  」空白,div p { } 選擇所有 p 在 div 區塊內的設定

----- 接下來是一些 屬性 attribute 的設定 ---------------------

::before,在元件之插入樣式
::after,在元件之插入樣式,例如底下針對 h2 在的前後增添了 ※ 符號
      .page h2:before{ content:"※"; }
      .page h2:after{ content:"※"; }

#x_hint { color:red; text-decoration:none;}
#x_hint:hover { background-color:red; color:yellow;}

 選擇器 . 」界說 class,典範利用  <DIV class="footer"><p>這是底部 © copyright 2017;</p></DIV>,後面CSS設定都省略 <style> 標籤的註記

reference: https://www.w3schools.com/cssref/css_selectors.asp 

:target,可應用在網頁內 anchor 的跳躍點,當跳到 #name 點時改變該點的樣式,例如
   p:target {  background-color: yellow; }
   <a href="#loc1">link</a>
   <p id="loc1"> ..... </p>

一般超保持     Hint 超貫穿連接

<style>
   .footer { background-color:#550B00;  color:#FFF;  height:50px;}
</style>

 選擇器 +」, div + p { } 選擇與 div 緊接著的 p 區塊(若中央有其他 tag 就不會套用,有空白或文字不受影響),範例:
<div>
     <p>div 內 p 區塊</p>
</div>
12345678
<p>第一段落</p>
<p>第二段落</p>

~End

:in-range:out-of-range   可用來判定輸入框輸入的局限是不是准確,在規模內或跨越賜與樣式設定
    input:out-of-range {  background-color: red; }
    <input type="number" min="1" max="100">

這是底部 © copyright 2017;

*」:[attribute*=value],例 a[href*=go] { font-weight: bold; } 只要保持 href 的值有 go 關鍵字就會套用此結果,go 、 good 、gogoro ... 都算相符這前提唷~
^」:[attribute^=value],例 a[href^=https] { font-weight: bold; } 保持 href 的值為 https 字開頭,就會套用此結果
$」:[attribute$=value],例 a[href$=docx] { font-weight: bold; } 貫穿連接 href 的值為 docx 字結尾,就會套用此結果
~」:[attribute~=value],例 img[title~=news] title 申明有 news 文字就會套用此結果,new、newbra 等都不是,文字必需完全 match
|」:[attribute|=value],結果同 ^ 取屬性的開首做判定

 

 選擇器 , 」一次定義多個元件共通屬性,底下例子是同時指定 body 與 html 都具有下方的設定值

選擇器 「~」, p ~ strong { } 設定在 p 區塊以後的 strong 區塊感化
<strong> 粗體字 </strong>
<p>段落文字</p>
<strong> p 區塊後的粗體字 </strong>
<p>段落文字 <strong>222</strong></p>

----- 接著是某個狀態結果的設定 ---------------------

div + p { background-color: yellow; }

在這類  [attribute=value] 設定體式格局還有多種符號可以進一步套用選擇,
請留意:該符號要寫在等號左邊

div  > p { background-color: yellow; }

選擇器 [attribute] 設定某個屬性的 CSS 結果,底下 critical 屬性是自行定義的
<a href="https://www.nctu.edu.tw">NCTU</a>、
<a href="https://www.nthu.edu.tw" critical >NTHU</a>、
<a href="https://www.ncu.edu.tw">NCU</a>

:active,用在 a 標籤,當點下貫穿連接時的回響反映。     類型 a:active { background-color: yellow; }
:link,用在 a 標籤,該貫穿連接網站還沒瀏覽過的顯現樣式。     典範 a:link { color: blue; }
:visited,用在 a 標籤,該貫穿連接網站還已瀏覽過的出現樣式。     類型 a:visited { color: gray; }
:hover,當滑鼠移到物件上時出現的樣式 。     類型 a:hover { background-color: yellow; }

<div>
   <h2>這是題目 h6 文字</h2>
   <p>這是在 div 下的 p 區塊文字</p>
   <strong>  <p>「加粗體」這是在 div 下的 p 區塊文字 </p>   </strong>
</div>

 有效 CSS 的同夥都知道要定義 class 的屬性是用 「. 」 id 用「#」,但偶然參考他人的CSS檔案卻發現有「翻譯社 」、「> 」、「+ 」、「~ 」、「^ 」、「* 」、「$ 」... 等等的符號,這些稱為選擇器(Selector)每一個符號有著分歧的作用,今天就來看看可以怎麼利用翻譯

div p { background-color: yellow; }

 

html, body {
   font-size:16px;
   font-family:微軟正黑體,標楷體翻譯社san-serif;
}

 



以下內文出自: http://blog.xuite.net/tolarku/blog/490847586-CSS+Selector+%E9%81%B8%E6%93%87%E5%99%A8有關各國語文翻譯公證的問題歡迎諮詢天成翻譯公司02-77260931

創作者介紹
創作者 chambeeac08@outlook.com 的頭像
chambeeac08

chambeeac08@outlook.com

chambeeac08 發表在 痞客邦 留言(0) 人氣( 0 )