Select the active HTML anchor, <a> element - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:target

Description

Select the active HTML anchor, <a> element

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
:target {<!--from  w  ww . j ava 2  s.  co  m-->
    border: 2px solid red;
    background-color: blue;
}
</style>
</head>
<body>

<h1>This is a heading</h1>

<p><a href="#news1">Jump to New content 1</a></p>
<p><a href="#news2">Jump to New content 2</a></p>

<p id="news1"><b>New content 1...</b></p>
<p id="news2"><b>New content 2...</b></p>

</body>
</html>

Related Tutorials