Select the active link and paragraph. - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:active

Introduction

Click on the paragraphs, headers, and links to see what is getting a style.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
p:active, h1:active, a:active{
    background-color: yellow;
}
</style><!-- w ww  . j av  a 2s.  com-->
</head>
<body>

<h1>Welcome to My Homepage</h1>

<div class="intro">
  <h2 id="myId">this is a test</h2>
  <p id="myElement">this is a paragraph</p>
  <p>I <b>like</b> css</p>
</div>

<h2>Links:</h2>
<p>Here are my favorite websites:</p>
<a href="https://www.java2s.com">java2s.com</a>
<a href="http://www.google.com" target="_blank">google.com</a>
<a href="http://www.wikipedia.org" target="_top">wikipedia.org</a>


</body>
</html>

Related Tutorials