What exactly is `span` used for?

Thanks for sharing this video. It’s help me to understand what span can be used for. :grinning:

thanks for the video, it was really helpful :slight_smile:

how can i get the code or video of the html/css simple project you showed in this video?

this totally made sense. thank you

This really clarified its use. Thanks

Thanks for sharing the video, the explanation is well made, though the part where CSS code is used might feel too loaded for new learners, also the lack of correct indentation is distracting.

Yes, you can have a <span> within a <span>. The <span> tag is just like the <div> tag except it’s an inline element instead of a block element.
For example, <p>Here’s an example of a span within a span within a paragraph. <span style=“color:red”>This sentence will have color red, <span style=“color:green”>except for this part, which will be green,</span> unlike the rest.</span> There you go.</p>
will be displayed as:

Here's an example of a span within a span within a paragraph. This sentence will have color red, except for this part, which will be green, unlike the rest. There you go.

Ok, it doesn’t work as I intended it to go, but you can try the code on your own and see, or wait a bit, I will make a screenshot.


Here’s the result. Sorry for making another post, it wouldn’t let me edit my comment again…


This particular article was helpful…Thanks’

This is very helpful, thanks!

good explanation I get the point

Thanks for the quick and clear clarification!

if l will try to answer in my idea, span is used when you need to separate multiple designs or do anythink in one paragraph is used to span inside paragraph.

1 Like

This video is great pure telling

1 Like

same thing for div right

1 Like

Very well explained :slight_smile:

It is more to group larger chunks of content. The <div> tag in HTML is utilized as a versatile container element, allowing the grouping of other HTML elements for the purpose of styling, layout structuring, and organizing content on a webpage. While it doesn’t hold inherent meaning on its own, the <div> tag is a fundamental tool for web developers to create divisions within the webpage, apply CSS styling, and facilitate consistent design across various sections of the site. It serves as a cornerstone for arranging content blocks, designing layouts, and enabling a more organized and visually appealing presentation of web content.

As someone starting their coding “adventure”, thank you!

Video was very helpful. Thanks