All About Pseudo Selector And Why We  Use

All About Pseudo Selector And Why We Use

Pseudo Class Selector

11)Adjacent Sibling Class Selector

  • Select elements that are siblings of the first element and come directly after the first element
  • Selects all anchors that are siblings of a div and come directly after the div
  • applies the only sibling after that selected element 1.png

12.png

12)Hover Class Selector

  • Select elements that are hovered by the mouse .Select buttons that are being hovered

2.png

22.png

13)focus Class Selector

  • Select elements that are focused.
  • Select buttons that are being focused
  • Focus is set by either tabbing to an element or clicking an element such as a button or anchor tag

3.png

31.png

14)Required Class Selector

  • Select inputs that are required
  • Select inputs with the required attribute

4.png

41.png

15)Checked Class Selector

  • Select checkboxes/radio buttons that are checked
  • Select inputs that are checked

5.png

51.png

ALL ABOUT PSEUDO ELEMENT/CLASS/CLASS POSITION SELECTOR

1.what they are how they work 2.the misunderstood content property 3.using them as design elements

:: →→ pseudo element Selector

: →→ pseudo class Selector

Pseudo Element Selector

1.what they are how they work

16)Before Selector

  • Creates an empty/content element directly before the children of selected element
  • div::before

17)After Selector

  • Creates an empty/content element directly after the children of selected element
  • div::after Empty pseudo Element Selector

7.png

71.png content pseudo Element Selector

77.png

771.png

img source is content .pseudo element can not work in images. yes on img tag pseudo element not working I learn that in very hard way

2.the misunderstood content property(What is Purpose of pseudo Element)

  • pseudo element in browser cant be selected if you try then do it. yes you cant selected its manually. just try it out
  • in this content hello cant be selected by mouse dragging

2A.png

yes, its true that pseudo element cant be work on img, but img can be used as content of pseudo element

1 pseudo element as image

  • pseudo element ::before and ::after content cant be selected its pseudo element selector they just hang out there
  • you can use image as content as ::before and ::after also you can use icon .3d elements use in that way

1a.png 1a1.png

2 its use for the give open quote-close quote to any styling and close quote too

2q.png 2qa.png 3) & 4) for the tool tip

3a.png

3a3.png

  • margin-top: just output is visible for the screen
  • white-space: nowrap; means take space it needs to be
  • transform: scale(0); means hide or disappear display size
  • a[data-tool-tip]:hover::after{ } means hover must be in Centre otherwise wont work

5)for the title decoration and use font awesome as pseudo selector

5.png

5a1.png

6)for the link decoration use pseudo element

6a.png

6a1.png

Pseudo Class Position Selector

18)First Child Selector

  • Select elements that are the first child inside a container
  • Select anchors that are the first child
  • a:first-child

18.png

181.png

19)Last Child Selector

  • Select elements that are the last child inside a container
  • Select anchors that are the last child
  • a:last-child

19.png

191.png

20)Nth Child Selector

  • a:nth-child(2n)
  • Select elements that are the nth child inside a container based on the formula
  • Select anchors that are even numbered children

20.png

201.png

21)Nth Last Child Selector

  • a:nth-last-child(3)
  • Select elements that are the nth child inside a container based on the formula counting from the end
  • Select anchors that are the third to last child

21.png

211.png

22)Only Child Selector

  • a:only-child
  • Select elements that are the only child inside a container
  • Select anchors that are the only child

23)First Of Type Selector

  • a:first-of-type
  • Select elements that are the first of a type inside a container
  • Select the first anchor in a container

22a.png

23a.png

24)Last Of Type Selector

  • a:last-of-type
  • Select elements that are the last of a type inside a container
  • Select the last anchor in a container

24a.png

24b.png

25)Nth Of Type Selector

  • a:nth-of-type(2n)
  • Select elements that are the nth of a type inside a container based on the formula
  • Select every second anchor

26)Nth Last Of Type Selector

  • a:nth-last-of-type(2)
  • Select elements that are the nth of a type inside a container based on the formula counting from the end
  • Select the second to last anchor

27)Only Of Type Selector

  • a:only-of-type
  • Select elements that are the only of a type inside a container
  • Select anchors that are the only anchor in a container

28)Not Selector

  • a:not(.c)
  • Select all elements that do not match the selector inside the not selector
  • Select all anchor tags that do not have the c class