HTML div and span
Introduction to html div and span elements and their differences.
- Commonalities
- Neither of div and span has semantic value (styling effect) by default;
- They exist to allow users to apply styling to its content;
- Div can be made as span with style=”display:inline;”;
- Span can be made as div with style=”display:block;”.
- Differences
- Div is a block-level element often used as a container for other html elements;
- Div will have a line break both before and after it;
- Span is an inline element often used as a container for some text;
- Span do not have line break either before or after it.
References