Home
CSS
CSS Box Sizing
Tryit: Result with box-sizing
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> .div1 { width: 300px; height: 100px; border: 1px solid blue; box-sizing: border-box; } .div2 { width: 300px; height: 100px; padding: 50px; border: 1px solid red; box-sizing: border-box; } </style> </head> <body> <h1>With box-sizing</h1> <div class="div1">Both divs are the same size now!</div> <br> <div class="div2">Hooray!</div> </body> </html>