Can anyone give me the difference between div and span tags?
The difference between span and div is that a span element is in-line and usually used for a small chunk of in-line HTML whereas a div (division) element is block-line (which is basically equivalent to having a line-break before and after it) and used to group larger chunks of code.
<div id="scissors">
<p>This is <span class="paper">crazy</span></p>
</div>
div and especially span shouldn't actually be used that often. Whenever there is a sensible alternative that should be used instead. For example, if you want to emphasize the word 'crazy' and the class 'paper' is bold, then the code might look like this:
<div id="scissors">
<p>This is <strong class="paper">crazy</strong></p>
</div>
div - it is a dom element with display property as a block that is element will take the whole row that is with the line-break.
<div>Your website name?</div>
<div>http://www.array151.com</div>
will be displayed in two different rows. and each div will be considered as an individual block.
Your website name?
http://www.array151.com
span - dom element with display property inline that is without line-break.
<span>Your website name?</span>
<span>http://www.array151.com</span>
the result will be on the same line because of the span
Your website name?http://www.array151.com
Div is a block element; span - inline, so
Div: It is working like as a Block, equivalent to having a line-break. Span: It is working like as an inline. For Example :
**
Div and Span Difference
Div Example
My Name is Aruna ThakurSpan Example
What is Your Name : My Name is Aruna Thakur
**`End Code'