Activity › Forums › Salesforce® Discussions › Difference between ‘div’ and ‘span’ tags in Salesforce
-
Difference between ‘div’ and ‘span’ tags in Salesforce
Posted by Kumar on December 28, 2016 at 12:55 PMHi everyone,
What is the difference between <div> and <span> tags ?
Thanks
Parul replied 7 years, 7 months ago 5 Members · 4 Replies -
4 Replies
-
Hi Kumar,
Span-
While a span allows you to separate things from the other elements around them on a page or within a document, it does not cause a line break. This is why it is perfect for in-line styling, like coloring a single word in a sentence to draw more attention to it.
Div-
But a div, by default, creates a line break because it is used to make separate containers or boxes within a page or document, hence the name division. So the proper way to use a div is as a containing element, rather than an inline styling element.
Thanks
- [adinserter block='9']
-
Hi,
The difference between span and div is that a span element is in-line and usually used for a small chunk of HTML inside a line (such as inside a paragraph) 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.
Thanks
-
Hello,
Div and span tag is an HTML tag and we use div tag for the division or we say a new line and span tag for in-line content.
Thanks.
-
Adding some point:
The div is a block level, meaning it’s on its own separate line.
It is better referred for a block of content having different nested elements,
span is inline, so it’s a child of another block level element.
spen is nothing but an empty element,
Thanks
Log In to reply.