Advertisement
gurumutant

Box Model dan Floating

Oct 9th, 2023
1,342
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.19 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. body { margin: auto; background-color: lightblue; }
  6. .container {
  7.     width: 454px;
  8. }
  9. div.d1 {
  10.   background-color: lightgrey;
  11.   width: 160px;
  12.   border: 15px solid green;
  13.   padding: 10px 30px 10px 60px;
  14.   margin: 1px;
  15.   float: left;
  16. }
  17. p.d2 {
  18.   background-color: powderblue;
  19.   width: 100px;
  20.   border: 15px solid green;
  21.   padding: 10px 20px 10px 20px;
  22.   margin: 1px;
  23.   float: left;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28.  
  29. <h2>Demonstrating the Box Model</h2>
  30.  
  31. <p>The CSS box model is essentially a box that wraps around every HTML element. It consists of: borders, padding, margins, and the actual content.</p>
  32. <div class="container">
  33. <div class="d1">This text is the content of the box. We have added a 50px padding, 20px margin and a 15px green border. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
  34. <p class="d2">Div ke 2</p>
  35. </div> <!-- .container -->
  36. </body>
  37. </html>
  38.  
  39.  
  40.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement