Advertisement
rezamalik15

Block vs Inline Element

Mar 21st, 2023
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.67 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en">
  3.     <head>
  4.         <meta charset="UTF-8">
  5.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.         <title>Block vs Inline</title>
  7.         <style>
  8.             .block {
  9.                 padding: 10px;
  10.                 background-color: cyan;
  11.             }
  12.  
  13.             span {
  14.                 background-color: yellow;
  15.                 color: red;
  16.             }
  17.         </style>
  18.     </head>
  19.     <body>
  20.         <p class="block">
  21.             This is p element. It is a block level element. It will take up the full width
  22.         </p>
  23.  
  24.         <p>
  25.             This is another p element. But I can put inline-level element like <span>span</span>. Since span is an <u>inline-level element</u>, it will go no where. It is still where it is.
  26.         </p>
  27.     </body>
  28. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement