Home
HTML
HTML id attribute
Tryit: use id to style element
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> #myHeader { background-color: lightblue; color: black; padding: 40px; text-align: center; } </style> </head> <body> <h2>The id Attribute</h2> <p>Use CSS to style an element with the id "myHeader":</p> <h1 id="myHeader">My Header</h1> </body> </html>