HTML CSS examples for CSS Selector:id
The #id selector selects element by id value.
Select the element with id="myId":
<!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>