0
Has anyone try pseudo class styling? Should it be second- or 2nd? third- or 3rd- ? I can 't come up with any thing trying both in code play?
10 Answers
+ 4
To taget any other child than 'first' and 'last', use:
:nth-child(n)
p:nth-child(2) Selects every <p> element that is the second child of its parent.
+ 2
Well... if you have a first DIV for your header section and a last DIV for Footer section, PSEUDO-CLASSES will be a good way to aply styles. anyway, you wanna know about the DIV between the first and last DIV that you have in your code, right? If you need to change groups of DIV, try to create a more significant inheritance.
Sugestions:
1st div = HEADER => DIV: FIRST-CHILD {arguments}
last div = FOOTER => DIV: LAST-CHILD {arguments}
2nd, 3rd, ..., Nth DIV => Use other selectors
*div article
*article
*class
*id
Realize that PSEUDO-CLASSES are an alternative that provide a more powerful control.
My best shot is recomend you this course: <www.mva.microsoft.com/en-US/training-courses/css-jump-start-8474l=DtR0aRXXz_404984382>
0
could you be more especific?
0
Pseudo-classes are applied in element groups, like DIV, ARTICLE, HEADER, FOOTER, etc. If you wanna aply a style in a part of a content, maybe change the color of a letter or a word, then you will need to use PSEUDO-ELEMENTS.
PSEUDO-CLASSES = CONTENT GROUPS
PSEUDO-ELEMENTS = AN ESPECIFIC POINT >INSIDE< A GROUP
0
what I tried is: using the solo example, there are five <p> within a <div>, the div::first-p , and the div::last-p is okay.
but second::p? third-p no. Is there anything wrong in my first question?
0
although I don't think there will be situation of having 85 siblings (see this in mozilla), and have the need to modify the 37th, the 53th pseudo elements; theoretically the program should be able to count (not me) the position/numbering of the element group? agree?
0
bom dia
0
23062019
Though it had been years from my first question, still want to thank for all responses. Pueudo elements , I found an experienced, useful for styling elements where the 'locations' in html are not easily located; or when some little tricky styles are needed, for that elements, out of some generalities.
0
As for the example of DIV: ( from Kardhyr), you should be apply case switch codes. The main point is about the 'notations'. first-element, never use 0th-element! last-element, never nth-element. Must aware that all 'elements' are stored in arrays. I read this somewhere from other tutorials, helped to understand why codes are written in such ways!
- 1
PSEUDO-CLASSES = CONTENT GROUPS
PSEUDO-ELEMENTS = AN ESPECIFIC POINT >INSIDE< A GROUP