0
我知道有這麼多的問題,但我認爲這是一個關於第n個孩子的新問題。我試圖與訂單CSS第n個孩子創建序列奇數
- 奇數那張左甚至構建多個簡檔頁面進入右
- 奇數N1 = background1(1)甚至N1 = backround2(1)
- 奇數N2 = background1(2)甚至n2 = backround2(2)
- 奇數n3 =背景1(3)偶數n3 =背景2(3)
- 它簡單地青色洋紅黃色,並且總是重複。 b1cyan左邊,b2magenta右邊,b1黃色左邊,b2cyan右邊,b1magenta左邊,b2黃色右邊等等。
.wrapper{
width:50%;
position:relative;
margin:0 auto;}
.items{
width:100%;}
.items:nth-child(odd){
text-align:left;}
.items:nth-child(even){
text-align:right;}
.items:nth-child(odd):not(:nth-child(3n+1)){
\t background:cyan;
\t background-size:100% 100%;
\t }
.items:nth-child(even):not(:nth-child(3n+1)){
\t background:magenta;
\t background-size:100% 100%;
}.items:nth-child(odd):not(:nth-child(3n+2)){
\t background:yellow;
\t background-size:100% 100%;
\t }
.items:nth-child(even):not(:nth-child(3n+2)){
\t background:cyan;
\t background-size:100% 100%;
\t }
.items:nth-child(odd):not(:nth-child(3n+3)){
\t background:magenta;
\t background-size:100% 100%;
\t }
.items:nth-child(even):not(:nth-child(3n+3)){
\t background:yellow;
\t background-size:100% 100%;
\t }
<div class="wrapper">
<div class="items">a</div>
<div class="items">b</div>
<div class="items">c</div>
<div class="items">d</div>
<div class="items">e</div>
<div class="items">f</div>
<div class="items">g</div>
<div class="items">h</div>
<div class="items">i</div>
<div>
似乎.items:nth-child(odd):not(:nth-child(3n+1))
意味着
在順序(3x0)奇數1項應該做此等等但是。它沒有工作,因爲我打了。
請幫忙
事實並非如此。但thx爲您的貢獻。我會更新我的問題。請檢查。一分鐘請 –
@riverrhun我已經更新了CSS。請讓我知道,如果這是你在找什麼。 –
男人這是真的。但你能解釋一下這裏發生了什麼? 3n +數字它假設的意思,我試圖複製粘貼你的代碼到我的本地主機,結果已經改變。 –