MozTW 討論區 https://forum.moztw.org/ |
|
CSS 3 中的 :nth-child(2n+1) 表示奇數? https://forum.moztw.org/viewtopic.php?f=13&t=8626 |
第 1 頁 (共 1 頁) |
發表人: | 水幻雲 [ 2005-05-27, 20:29 ] |
文章主題 : | CSS 3 中的 :nth-child(2n+1) 表示奇數? |
引言回覆: The :nth-child(an+b) pseudo-class notation represents an element that has an+b-1 siblings before it in the document tree, for a given positive integer or zero value of n. In other words, this matches the bth child of an element after all the children have been split into groups of a elements each. For example, this allows the selectors to address every other row in a table, and could be used, for example, to alternate the color of paragraph text in a cycle of four. The a and b values must be zero, negative integers or positive integers. The index of the first child of an element is 1.
從這段定義看來 2n+1 似乎不包括第一個 child 啊? 感覺 2n-1 才是對的? (不好意思,我的英文實在太破了) 順便問一下 :nth-of-type(an+b) 是不是只數相同名稱的標籤? |
發表人: | danielwang [ 2005-05-27, 20:46 ] |
文章主題 : | |
W3C 寫: for a given positive integer or zero value of n n >= 0 ![]() |
發表人: | 水幻雲 [ 2005-05-27, 21:01 ] |
文章主題 : | |
啊……啊…… 原來如此…… |
第 1 頁 (共 1 頁) | 所有顯示的時間為 UTC + 8 小時 |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |