This time to bring you the selector nth-child and: Nth-of-type of the use of detailed, using the selector nth-child and: What are the considerations of Nth-of-type, the following is the actual case, together to see.
Let's look at a simple example, first of all, the HTML section:
Then the two selectors corresponding t
In css, table tr: nth-child (even) changes tr background color: IE7, 8 is invalid, nth-childtrFor example:
. My_table tr: nth-child (even) {background: # E6EDF5;}. my_table tr: nth-child (odd) {background: # F0F5FA ;}IE7, 8 is invalid and cannot be identified.
Another method:Add class to tr to be discolored
. Table_
Nth-child is the element that selects all elements under the current parent element, while Nth-of-type represents the first element of a given type that selects a parent element.For example, select the first P element under the p parent element, so you can write:Parent>p:first-child or Parent>p:first-of-type, the first way to do this is that there is nothing wrong with the initial element p under the parent
If there is a t_user data table in this way, the table ID increases automatically, but the IDs in the data table are not guaranteed to be continuous. Write an SQL statement, query the data between the n-th record and the M-th record (M> N> 0, all smaller than the total number of records in the data table)
The idea is as follows:
First, find the ID of the nth record and the nth record.
Obtain the ID
: Nth-child and: Nth-of-type are CSS3 in the pseudo-class selector, its role is similar but not exactly the same, for unfamiliar people may not be very different, this article will introduce the difference between the two, in order to facilitate the correct use of both types of selectors.Let's look at the following two lines of CSS:P:nth-child (2) {color:red;}P:nth-of-type (2) {color:red;}① for :
For details about nth-child and nth-of-type in jQuery, jquerynth-child
First, paste the HTML code:
The display result of the entire page is:
Please replyFrom left to rightWhich lines of buttons have the background color changed?
Click the first one:
4,10
Click the second one:
7, 10
Click third:
2, 5, 10
Click Fourth:
2, 6, 10
Are you correct? If it is correct, click Close in the upper right corner.
Fro
This article mainly introduces the CSS3 selector: Nth-child and: Nth-of-type between the difference, very practical value, the need for friends can refer to the next
Let's look at a simple example, first of all, the HTML section:
Then the two selectors corresponding to the CSS code are as follows:
P:nth-child (2) {color:red;}
P:nth-of-type (2) {color:red;}
In this example, the two selectors achieve the
Then the corresponding CSS code for the 2 selectors is as follows:P:nth_child (2) {color:red;}P:nth-of-type (2) {color:red;}The two corresponding effects are the same:For: The Nth-child selector has two points to explain:1, this is a paragraph element.2, this is the second child of a parent elementFor: The nth-of-type selector means selecting an element if:1, select the second paragraph Child element of the
For :nth-child selectors, it means selecting an element if:
This is a paragraph element.
This is the second child element of the parent tag
For :nth-of-type selectors, it means selecting an element if:
Select the second segment of the parent tag Lazi element
-Look at the effect ...The difference between the Nth-child and the CSS3:
LeetCode 19 Remove Nth Node From End of List Remove the Nth Node, leetcodenth
Question:
Given a linked list, remove the nth node from the end of list and return its head.
For example,
Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5.
Note:Given n will always be valid.Try to do this
LeetCode-19 Remove Nth node from End of List (remove tail nth node)
Given A linked list, remove the nth node from the end of the list and return its head.
For example,
Given linked list:1->2->3->4->5, and n = 2.
After removing the second node from the end, the linked list becomes 1->2->3->5.
Note:Given n would always be valid.Try to do the in one pass.
Select the nth child or odd-even element that matches the parent element:Instance:inchdiv.inchDiv.inchThe div.inchAnother div.inchAnother div.[jquery selector: Nth-child] Select to match the nth child or odd-even element under its parent element
Given A linked list, remove the nth node from the end of the list and return its head.For example, n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5.Note:Given n would always be valid.Try to do the in one pass.Subscribe to see which companies asked this questionSolution 1: Scan the list first, count the total number of elements, and then traverse the list from the beginning until you reach the previous node whe
1. Specify the style of the first child element and the last child element individually2. Use styles for child elements of the specified ordinal3. Use styles for all sub-odd or odd-number child elementsCSS3 First-child, Last-child, Nth-child, Nth-last-child
ImportJava.util.Scanner;//title: A ball from the height of 100 meters of freedom falling, each landing back to the original height of half, and then down, to ask it to fall on the 10th time, the total number of meters? How high is the 10th time rebound? Public classBalltest { Public Static voidMain (string[] args) {DoubleFirsthight; intN; Scanner in=NewScanner (system.in);//read two data from the keyboardSystem.out.println ("Please enter from how many meters fall:"); Firsthight=in.nextdouble ()
P:nth-child (2)
To satisfy two conditions, 1: The second child element of the parent element of the P element is selected
2: The second child element of the selection must be a P element and will not be displayed if it is not satisfied
P:nth-of-type (2)
Select the second P element under a parent element
CSS3 pseudo-class, pseudo-element selector---nth-child () and
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...
Note:N is positive and would fit within the range of a 32-bit signed integer (n
Example 1:
Input:3
Output:3Example 2:
Input:11
Output:0
Explanation:The 11th digit of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, one, one, ... is a 0, which are part of the number 10.
Here are the practices of C + +
We first analyze the relationship between the natural number sequence
Today, I learned about jQuery and saw the nth-child (even) usage. I specifically found the usage of this selector. In the CSS3 standard, the usage is very powerful. In this regard, I will give a general introduction to the usage of nth-child () in CSS3:
CSS3 pseudo-class selector: nth-child ()
Briefly summarize several nth
A function to get the nth element node, now only gets the element through the first entry HTML tag, the function is not perfectDemo: HTMLulID= "List"> Li>1Button>AButton>Li> Li>2Button>BButton>Button>OButton>Li> P>TestP> Li>3Button>CButton>Li> Li>4Button>DButton>Li> Li>5Button>EButton>Li>ul>Js:1 /**2 *3 * @param parent Parents node4 * @param ele the element label to select5 * Number of elements @param num6 * @return {*}7 */8 func
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.