CSS 3 nth of type 僅限於Class
nth-of-type 選擇器可讓您選擇特定類型的每第n 個子級。但是,將此選擇限制為特定類別可能具有挑戰性。
問題:
您希望動態定位每三個 .module 元素,無論其標記如何。不過,nth-of-type 是根據元素類型計算的,而不是類別。
解:
目前沒有直接的方法來限制 nth-of - 鍵入特定的類別。一種解決方法是手動向每三個 .module 元素添加一個附加類別。
例如,在提供的 HTML 中:
<section class="featured module"> <h1 id="NOT-A-VIDEO">NOT A VIDEO</h1> </section> <section class="featured module third"> <h1 id="NOT-A-VIDEO">NOT A VIDEO (3)</h1> </section> <section class="featured module"> <h1 id="NOT-A-VIDEO">NOT A VIDEO</h1> </section> <section class="featured module third"> <h1 id="NOT-A-VIDEO">NOT A VIDEO (6)</h1> </section>
然後套用以下 CSS 樣式:
.featured.module.third { padding-right: 0; background: red; }
現在將使用附加的 .third 來設定 .module類別每三次出現的樣式class.
注意:
此解決方法需要在新增或刪除 .module 元素時進行手動維護。對於更進階的場景,請考慮使用 JavaScript 或 CSS 預處理器自動產生必要的類別。
以上是如何使用 CSS'nth-of-type”將每三個元素指定為特定類別?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

是的,youshouldlearnbothflexboxandgrid.1)flexboxisidealforone-demensional,flexiblelayoutslikenavigationmenus.2)gridexcelstcelsintwo-dimensional,confffferDesignssignssuchasmagagazineLayouts.3)blosebothenHancesSunHanceSlineHancesLayOutflexibilitibilitibilitibilitibilityAnderibilitibilityAndresponScormentilial anderingStruction

重構自己的代碼看起來是什麼樣的?約翰·瑞亞(John Rhea)挑選了他寫的一個舊的CSS動畫,並介紹了優化它的思維過程。

CSSanimationsarenotinherentlyhardbutrequirepracticeandunderstandingofCSSpropertiesandtimingfunctions.1)Startwithsimpleanimationslikescalingabuttononhoverusingkeyframes.2)Useeasingfunctionslikecubic-bezierfornaturaleffects,suchasabounceanimation.3)For

@keyframesispopularduetoitsversatoryand and powerincreatingsmoothcsssanimations.keytricksinclude:1)definingsmoothtransitionsbetnestates,2)使用AnimatingMultatingMultationMultationProperPertiessimultane,3)使用使用4)使用BombingeNtibalibility,4)使用CombanningWiThjavoFofofofoftofofo

CSSCOUNTERSAREDOMANAGEAUTOMANAMBERINGINWEBDESIGNS.1)他們可以使用forterablesofcontents,ListItems,and customnumbering.2)AdvancedsincludenestednumberingSystems.3)挑戰挑戰InclassINCludeBrowsEccerCerceribaliblesibility andperformiballibility andperformissises.4)創造性

使用滾動陰影,尤其是對於移動設備,是克里斯以前涵蓋的一個微妙的UX。傑夫(Geoff)涵蓋了一種使用動畫限制屬性的新方法。這是另一種方式。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

Atom編輯器mac版下載
最受歡迎的的開源編輯器