apaCara
.com
editor
HTML
CSS
JS
PREVIEW
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Demo CSS Margin - apacara.com</title> <style> body {margin: 0} div { width: 50px; height: 50px; background: tomato; } /* style untuk demo */ .box1 { } .box2{ margin-left: 20px; } /* ini digunakan agar posisi element block berada di tengah-tengah */ .box3 { margin: 0 auto; } </style> </head> <body> <h5>Tanpa Margin</h5> <div class="box1"> box 1 </div> <hr /> <h5><code>margin-left: 20px;</code></h5> <div class="box2"> box 2 </div> <hr /> <h5><code>margin: 0 auto;</code></h5> <div class="box3"> box 3 </div> </body> </html>
/* CSS code */
// javascript code