Home
HTML
HTML Div
Tryit: center align a div 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> <style> div { width: 300px; margin: auto; background-color: #FFF4A3; } </style> <body> <h1>Center align a DIV element</h1> <div> <h2>London</h2> <p>London is the capital city of England.</p> <p>London has over 9 million inhabitants.</p> </div> </body> </html>