Course Content

If you are facing any issue in playing video please use Firefox browser.

Course Content

Description

What Is Target Pseudo Class And How To Use It?

Target pseudo-class represents the unique element. It targets particular element like suppose we took anchor tag and now we want it to redirect, then we will use Target pseudo-class  over there. Mostly target pseudo used as ID attribute. ID attribute was new in HTML4 but in older versions, it was used in <a> tag.

Let’s see an Example of it :
First take anchor tag :
<div id= “target” > this is html target </div>
<a href = “#target”> show me my target element</a>
Also, we have to write code in CSS :
Input [type=text] {background: red;  }
:target {background:yellow;  }

Go to browser and see the result. You will see, your target element got background color as yellow as we defined. We did not mention anything in HTML, but we can do modification in CSS in our way.

FAQs

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download The Apps

Code Scan or Download the app
Google Play Store
297K+ Downloads
4.5 Rating
10K+ Reviews
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere