Home
CSS
CSS Align
Tryit: Center vertically with padding
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> .center { padding: 70px 0; border: 3px solid green; } </style> </head> <body> <h2>Center vertically with padding</h2> <p>In this example, we use the padding property to center the div element vertically:</p> <div class="center"> <p>I am vertically centered.</p> </div> </body> </html>