URLs with an # followed by an anchor name link to a certain element within a document. The element being linked to is the target element.
The :target selector can be used to style the current active target element.
The :target selector can be used to style the current active target element.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
:target {
border: 4px solid green;
background: red;
}
</style>
</head>
<body>
<a href="#tar1">Click me 1</a>
<br>
<a href="#tar2">Click me 2</a>
<br> This is the sample text
<br>
<p id="tar1">This is the target 1</p>
<p id="tar2">This is the target 2</p>
</body>
</html>
Css:- Target Tag
Reviewed by Network security
on
May 23, 2019
Rating:
No comments: