Agyan
adda
Run
Reset
Copy
HTML Tutorial › HTML Block and Inline Elements › div vs span
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<div style="background: #e3f2fd; padding: 10px;"> This is a div. It takes the full width. </div> <div style="background: #fce4ec; padding: 10px;"> Another div starts on a new line. </div> <p> This sentence has a <span style="color: red; font-weight: bold;">red span</span> inside it, and it stays on the same line. </p>
Result