Css learning selector: nth-child (n)
Today, I learned a new small effect. For example, when a website changes the color of a line, for example, a black line or a white line, the zebra will show up. When you touch a line with your mouse, color background changes, especially when you connect to the database, simple code is very important.
At this time, an interesting friend appeared: nth-child (n) was alway
1,: Nth-child (2) Select the first few tags, "2 can be the number you want"2,: Nth-child (n+4) Select greater than or equal to 4 tags, "n" represents the integer from the same3: Nth-child (-n+4) Select less than or equal to 4 tags4,: Nth-child (2n-1) Select the odd label, 2n-1 can be odd5,:
https://leetcode.com/problems/remove-nth-node-from-end-of-list/Remove Nth Node from End of ListGiven 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.Title: Delete the l
Turn from: https://zhuanlan.zhihu.com/p/22174362
First of all, what is an automated test: Test automation in software testing, test automation are the use of special software (separate from The software being tested) to control the execution of tests and the comparison of actual outcomes with predicted .
This article also does not intend to summarize how many kinds of tests, how they classify, we only tal
First-of-type SelectorThe ": First-of-type" selector is similar to the ": First-child" selector, where the type of the element is specified , which is used primarily to locate the first child element of a type under a parent element.Sample Demo:With the ": First-of-type" selector, locate the first P element in the div container (p is not necessarily the first child element in the container) and set its background color to orange.HTML code:Divclass= "wrapper"> Div>I'm a block element, I'm the fi
[LeetCode-interview algorithm classic-Java implementation] [019-Remove Nth Node From End of List (Remove the last N nodes of a single-chain table)], removenode [019-Remove Nth Node From End of List (Remove the Nth Node From the last of a single-chain table )][LeetCode-interview algorithm classic-Java implementation] [directory indexes for all questions]Original q
Review and consolidate the use of CSS3 's Nth-child (). 2015-10-201 definitions on the world of:: The Nth-child (n) selector matches the nth child element that belongs to its parent element, regardless of the type of the element.n can be a number, a keyword, or a formula.2 usage examplesA is used to process a specific child element of an element,For example, P:bt
the JS page: $ ("#btn"), and then perform an event operation on it.Vii. class selector: $ (". Btn")First declare a class selector in HTML: class= "BTN", then find this ID selector in the JS page: $ (". Btn"), and then perform an event operation on it.Eight, Tag selector: $ ("tr")The tag selector is found in the JS page based on the label written in the HTML, such as TR, TD, and the event action on it.Nine, parity selector: odd (even), even (odd)$ ("tr:odd"), select All $ ("Tr:even"), select All
JQuery Method for operating the nth element of the same group element
Jquery operates on the nth element of the same group element. Example:
There are 3 ul under class = "phpernote", and now you want to add class = "com" to the 5th li elements under each ul"
Specific jQuery code:
$ (". Phpernote ul li: nth-child (5)"). addClass ("com ");
You have successfull
Pseudo-Class selector that represents the child element under which it is matched: Nth-child (n) indicates that from the nth child element, the "n" represents the number of words that were added by the beginning of the 0.: Nth-child (An=b) "n" represents the number of digits that are starting from 0, and "a" and "b" are values that you can customize, and the numb
in HTML: id= "BTN", and then find this ID selector in the JS page: $ ("#btn"), and then perform an event operation on it.4. Class Selector: $ (". Btn")First declare a class selector in HTML: class= "BTN", then find this ID selector in the JS page: $ (". Btn"), and then perform an event operation on it.5. Tag Selector: $ ("tr")The tag selector is found in the JS page based on the label written in the HTML, such as TR, TD, and the event action on it.6, Parity selector: odd (even), even (odd) $ (
InstanceSpecifies the background color of each p that belongs to the second child element of its parent element:p:nth-child(2){background: #ff0000;}Try it yourself.Browser support
IE
Firefox
Chrome
Safari
Opera
All major browsers support: Nth-child () selector, except for IE8 and earlier versions.Definition and usage: The Nth
Structural pseudo-Class selector-nth-last-child (n)": Nth-last-child (N)" selector and the previous ": Nth-child (N)" selector is very similar, but here is a "last", the role of the ": Nth-child (n)" selector differs, Select a specific element by starting the calculation from the last child element of a parent element.
jquery: First-child Selector Usage InstanceThis selector can match the first child element of the parent element.Syntax structure:$ (": First-child")This selector is typically used in conjunction with other selectors, such as class selectors, element selectors, and so on. For example:$ ("ul Li:first-child"). CSS ("Color", "blue")The above code can set the font color in the first LI element under the parent element to blue.Note: It is necessary to describe the concept in conjunction with the abov
https://leetcode.com/problems/remove-nth-node-from-end-of-list/Remove Nth Node from End of ListGiven 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.
The tip says
Article Introduction: 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!
Translated from:
useful:nth-child recipies
Chinese:
useful: The secret ingredient of Nth-child
Please respect the copyright, reproduced please indicate the source, thank you!
When I wan
Nth Highest SalaryWrite a SQL query to get the nth highest salary from the Employee table.+----+--------+| Id | Salary |+----+--------+| 1 | | | 2 | | | 3 | |+----+--------+For example, given the above Employee table, the n-th highest salary where n = 2 is 200 . If there is no nth highest salary and then the query should return null .https://leetcode.co
Structural pseudo-Class selector-nth-child (n)": Nth-child (N)" The selector is used to locate one or more specific child elements of a parent element . where "n" is its argument and can be an integer value (1,2,3,4), it can be an expression (2n+1,-n+5), and a keyword (odd, even), but the starting value of parameter n is always 1, not 0. That is, the value of the parameter n is 0 o'clock, and the selector w
Last-of-type SelectorThe selector :last-of-type and the :first-of-type selector function are the same, but the difference is that he chooses a type under the parent element 最后一个子元素 .Sample DemoWith the ": Last-of-type" selector, set the last paragraph element background in the container "div.wrapper" to orange( Hint: This paragraph is not the last child element of the "Div.wrapper" container).HTML code:Divclass= "wrapper"> P>I am the first paragraphP> P>I'm a second paragraph.P> P>I'm a third
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.