Selects the specified first child element under the specified (p) parent element from the forward number (regardless of where the target element is located in the parent element):Instance:inchDiv.inchDiv.inchDiv.inchDiv.inchdiv.inchdiv.inchdiv.inchAnother div.2inchAnother div.2inchdiv.inchDiv.inchdiv.inchDiv.[jquery selector: Nth-last-of-type ()] selects the spec
Before you want to select all the UL in the nth Li, so write: $ (' ul li:eq (N-1) '), it is the result of the selection of all the UL below the results of the nth elements, this thinking is wrong (because looked very pleasing: Select all the ul below the nth Li, in my Mind $ ( ' UL Li:eq (N-1) ') has been separated by me, if only the official could make this kind
Detailed CSS: Nth-child usageThe front-end buddies must have been in touch with a magical thing in CSS, you can easily choose the label you want and add style to the changes, is not very force, it is ": Nth-child."Below I will use
You can easily solve this problem by using this selector. Record it here.
Below is the main
Code
JS script:
Copy code The Code is as follows:
HTML code: Copy code The Code is as follows:
The specific usage will not be written here. For details, referHttp://www.jb51.net/css/28294.htmlHttp://www.jb51.net/article/23617.htmAs follows:
When I want the perfect use: Nth-child or: Nth-of-type is a little dizzy. The more you understand them, the better CSS rules you can write!
In these simple "recipes" (which are actually expressions) I will repeat the use of a simple list and then select the number. But it's obvious that it's easy to change them to get
Web page Production WEBJX article introduction: : Nth-child () working principle.
This is a CSS selector, a real pseudo class selector, which is nth-child (), and here's an e
)
LG:LT (2)
A collection of all elements (without n) in the collection of Li child elements in its parent element that follows the nth bit, starting with n 0
: Only-child
Div:only-child
Same as: Only-of-type
: Empty
P:empty
Same
In CSS Layout page development, we will also use a very useful selector, you can use it for the overall layout of the declaration, this is the universal selector. Look at the following code:
The code is as follows
Copy Code
*{margin:0;padding:0;}
This form of code typically does not appear multiple times, once in the page c
: Nth-of-type (N)
The selector matches each element of the nth child element of a particular type that belongs to the parent element.
n can be a number, a keyword, or a formula.
. Step_icon3 Li.item{width:30%;Height:40px;text-align:Center;Padding-top:10px-5px 0px;}. Step_icon3 li.item:nth-of-type (1){
In CSS , we use the:: First-line selector to apply a style to the first line of the element. But there is no such thing as:: Nth-line,:: Nth-last-line even:: Last-line such a selector. In fact, this phase selector is very useful i
If you want to give Id==outside div under the nine div assigned a different color to travel nine Gongge.At this time Nth-child () was used.It's written in style.#OutSide Div:nth-child (1) {background-color:red;}#OutSide Div:nth-child (2) {background-color:blue;}#OutSide Div:nth-chi
Child SelectorThere is also a more useful selector sub-selector , the greater than symbol (>), for selecting the first generation of child elements of the specified label element. code in the right-hand code Editor:. food>li{border:1px solid Red;}This line of code causes the child
Child SelectorCitation Link: http://blog.csdn.net/u012110719/article/details/41171517There is also a more useful selector sub-selector , the greater than symbol (>), for selecting the first generation of child elements of the specified label element. code in the right-hand code Editor:. Food>li{border:1px solid red;}T
Yesterday I practiced using CSS (that is, cascading style sheets cascading Stylesheet) Selector to locate the elements (Elements) on the (locate) page. It is highly recommended to use CSS Locator instead of XPath to locate elements in document Selenium official website.the reason is that
attributes positioningSame as CSS positioning the same as our Tag property selector input[name='N1') when used in combination with ID, class, it is easier to write the class INPUT.C1 ID input#i15. CSS Selector provides multi-attribute combination filteringCSS Selector Multi
The difference between first-child and first-of-type in the css Selector,
: The first-child selector is the selector defined in css2. It is also the first sub-element to be understood literally. For example, there is a code segme
element of a parent element, which can be said to be the first child of a structure.: First-of-type matches the first of the child elements of the same type under a parent element, such as P:first-of-type, which refers to the first of all child elements of type P. There is no longer a limit to the first child element,
child elements for span, matching to the first one.: The First-of-type matches the P elementTherefore, through the above two examples can draw a conclusion:: First-child matches the first child element of a parent element, which can be said to be the first child of a structure.: First-of-type matches the first of the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.