#id - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:id

Description

The #id selector selects element by id value.

Example

Select the element with id="myId":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
#myId {<!--from   ww w .ja  va 2 s .c  om-->
    background-color: red;
}
</style>
</head>
<body>

<h1>Welcome to My Homepage</h1>

<div class="intro">
  <p id="myId">this is a test.</p>
  <p id="myElement">this is a paragraph.</p>
</div>

<p>I <b>like</b> css.</p>

</body>
</html>

Related Tutorials