CodeLab
Tutorials For Everyone
Run
Learn CSS
<!Doctype HTML> <html> <head> <title>CSS Padding With Element Width and Box Sizing</title> <style> .div1{ padding: 20px; width: 200px; background: #555; color: #fff; box-sizing: border-box; } .div2{ padding: 0; width: 200px; background: #3949ab; color: #fff; } </style> </head> <body> <h2>CSS Padding With Element Width and Box Sizing</h2> Box-sizing property contained the content of the element to the width specified. Hence the width of both the elements remained similar. <div class="div1"> This div element has width of 200px with 20px padding. </div> <div class="div2"> This div element has width of 200px with 0px padding. </div> </body> </html>
Editor Commands
Ctrl
F
Find
Ctrl
G
Find Next
Ctrl
⇧
G
Find Previous
Ctrl
⇧
F
Find & Replace
Ctrl
]
Indent Code Right
Ctrl
[
Indent Code Left
⇧
Tab
Auto Indent Code
Ctrl
/
Line Comment
Ctrl
Alt
/
Block Comment
TutsInsider Actions
Alt
S
Run Code
Ctrl
C
Copy Editor Code
Ctrl
A
Select All Editor Code
Ctrl
S
Save/Download
Ctrl
Alt
X
Rotate
Ctrl
Alt
T
Switch Theme
Ctrl
⇧
C
Open Console
Esc
Close Console