Most Useful & Advance CSS3 Pseudo Classes

Most Useful & Advance CSS3 Pseudo Classes

Pseudo Classes help to select and apply the styles for a particular or group of HTML elements.

Pseudo Classes are used to apply the style while mouse hovering, visited, and unvisited links and focusing on the element.

We can use the Pseudo class with CSS Classes.

Pseudo Classes denoted by ( : ) symbol.
 

Syntax :

selector:pseudo-class {
  property: value;
}{codeBox}

 

Read :

 

     CSS Selectors That Every Developer Must Know

     CSS Pseudo Elements

 

There are many types of Pseudo Classes.


1): empty

 

    : empty Pseudo-class helps to select and apply the styles to the element without child node and text nodes.


Example :

    below example select and apply the style to the element without child or children node.

HTML


<p></p>

 

<p>Attractive Aurora One </p>


<p>Attractive Aurora Two </p>{codeBox}

 

CSS

 

p:empty {
  background: red;
}
{codeBox}

 

Output


                  


Attractive Aurora One

Attractive Aurora Two{codeBox}


2) :disabled

 

    : disabled Pseudo-class helps to select and apply the styles to the disabled element like input, buttons, and form elements.

 

Example :

    below example select and apply the background color to the disabled input.

HTML


<input value="attrativeaurora">

 

<input disabled value="attrativeaurora">{codeBox}

 


CSS

 

input:disabled {
  background: yellow;
}
{codeBox}


Output 

_________________

attrativeaurora|

_________________

attrativeaurora|{codeBox}                  



 

3):enabled

 

    : enabled Pseudo-class helps to select and apply the styles to the enabled element like input, buttons, and form elements.


Example :

   below example select and apply the background color to the enabled input.


HTML


<input disabled value="attrativeaurora">

 

<input value="attrativeaurora">{codeBox}

 


CSS

 

input:enabled {
  background: red;
}
{codeBox}


Output 

_________________

attrativeaurora|

_________________

attrativeaurora|{codeBox}                  


4):first-of-type

 

    :first-of-type Pseudo-classes help to select and apply styles to the first child of the same element of a parent.

 

Example : 

     

    below example select and apply the style to the first paragraph.

 

HTML


<div>

    <p>Attractive Aurora One </p>

    <p>Attractive Aurora Two</p>

</div>{codeBox}

CSS

p:first-of-type {
  background: green;
}
{codeBox}

Output

Attractive Aurora One

Attractive Aurora Two{codeBox}


 

5)Anchor Pseudo-classes

 

    Anchor Pseudo-classes helps to apply the style based on the link state.

 

    For example, hover the link, visited link, active link, and more.


Example : 

 

HTML


<a href="https://www.attractiveaurora.com" target="_blank"> Attractive Aurora</a>{codeBox}

 

CSS

/* unvisited link */
a:link {
  color: red;
}

/* visited link */
a:visited {
  color: blue;
}

/* mouse over link */
a:hover {
  color: green;
}

/* selected link */
a:active {
  color: orange;
}{codeBox} 

Output

Attractive Aurora /* unvisited link */

Attractive Aurora /* visited link */

Attractive Aurora /* mouse over link */

Attractive Aurora /* selected link */{codeBox}

 

6):first-child

 

    :first-child Pseudo-classes help to select and apply styles to the first child of any element.

 

Example : 

     

    below example select and apply the style to the first paragraph of every div element.

 

HTML


<div>

    <p>Attractive Aurora One </p>

    <p>Attractive Aurora Two</p>

</div>{codeBox}

CSS

div p:first-child {
  color: blue;
}
{codeBox}

Output

Attractive Aurora One 

Attractive Aurora Two{codeBox}

 

 

I think this information is helpful to you.

 

Thanks for reading - Don't Forgot To Share & Comment

Any suggestion or queries please comment, our team will response asps.

 

You may like this

 

         CSS Pseudo Elements

         CSS Selectors That Every Developer Must Know

 

         Javascript Web API's That Every Developer Should Know

         HTML API's That Every Developer Should Know


1 Comments

  1. Generally speaking, these tessellations don't cause an issue for 3D printing, lengthy as|so long as} the mesh and the intended mannequin have discrepancies smaller than the decision of the 3D printer. If you are be} happy with the quality of your 3D prints, and the pace at which their respective STL recordsdata are processed in Eiger, then congratulations — there’s no want to change something that’s working well! The defining traits of low decision STLs are 3D prints with flat spots Direct CNC in regions that should have smoothly curved faces. A few 3D printers with a number of} extruders can print objects in two or extra colors. Most are dual-extruder models, with each extruder being fed a special shade of filament. The LulzBot Mini 2 is a good alternative for individuals, colleges, and neighborhood centers because of its easy setup and operation.

    ReplyDelete
Previous Post Next Post