響應式網頁前端設計

第一階段
加強熟識HTML&CSS

第二階段
學習JavaScript&jQuery

第三階段
Bootstrap協助專案設計

第四階段
w3.css協助專案設計

第五階段
自行開發網站專案設計

第六階段
Pug(Jade)&Sass協助開發效率

=== TSuiling write 2018.07 ===

響應式網頁前端設計【第一階段】加強熟識HTML&CSS

選取器 加強範例

:nth-child(n) vs :nth-of-type(n)

版本 選取器 舉 例 說 明
2 :first-child p:first-child 符合左側指定的元素, 並且是所屬層次中的第一個子元素。 參考【英文版】 【簡中版
3 :first-of-type p:first-of-type 在所屬層次中符合左側指定元素的第一個元素。 參考【英文版】 【簡中版
3 :last-child p:last-child 符合左側指定的元素, 並且是所屬層次中的最後一個子元素。 參考【英文版】 【簡中版
3 :last-of-type p:last-of-type 在所屬層次中符合左側指定元素的最後一個元素。 參考【英文版】 【簡中版
3 :only-child p:only-child 符合左側指定的元素, 並且是所屬層次中的唯一子元素。 參考【英文版】 【簡中版
3 :only-of-type p:only-of-type 在所屬層次中符合指定元素p, 並且只有一個指定元素p。 參考【英文版】 【簡中版
3 :nth-child(n) p:nth-child(n) 符合左側指定的元素, 並且是所屬層次中符合第 n 個子元素。 參考【英文版】 【簡中版
3 :nth-of-type(n) p:nth-of-type(n) 在所屬層次中符合第 n 個指定元素 p。 參考【英文版】 【簡中版
3 :nth-last-child(n) p:nth-last-child(n) 符合左側指定的元素, 並且是所屬層次中符合倒數第 n 個子元素。 參考【英文版】 【簡中版
3 :nth-last-of-type(n) p:nth-last-of-type(n) 在所屬層次中符合倒數第 n 個指定元素 p。 參考【英文版】 【簡中版
3 :not(選取器) :not(p) 排除指定標籤之外的符合元素為選取器。 參考【英文版】 【簡中版

HTML 部份

<h1 style="text-align:center;">測試:nth-child與:nth-of-type</h1>

<p>1111111111</p>
<p class="abc">2222222222</p>
<p class="abc">3333333333</p>
<p>4444444444</p>
<p>5555555555</p>
<p>6666666666</p>

<div style="background-color:#add0ef;margin:10px;padding:10px;">777777777777</div>
<div class="abc" style="background-color:#add0ef;margin:10px;padding:10px;">777777777777</div>

<div style="background-color:#add0ef;margin:10px;padding:10px;">
    <p>1111111111</p>
    <p>2222222222</p>
    <p class="abc">3333333333</p>
    <p>4444444444</p>
    <p>5555555555</p>
    <p>6666666666</p>
</div>

<div class="abc" style="background-color:#add0ef;margin:10px;padding:10px;">777777777777</div>

測試相關 -child 與 -of-type

<h1>測試相關 -child 與 -of-type

<p>1111111111

<p class="abc">2222222222

<p class="abc">3333333333

<p>4444444444

<p>5555555555

<p>6666666666

<div>777777777777
<div class="abc">777777777777

<p>1111111111

<p>2222222222

<p class="abc">3333333333

<p>4444444444

<p>5555555555

<p>6666666666

<div class="abc">777777777777