What is the function of span | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

What is the function of span

Span in css

31st May 2021, 10:24 AM
Micheal Alfred
3 Answers
+ 3
https://www.w3schools.com/tags/tag_span.asp#:~:text=The%20tag%20is%20an,span%3E%20is%20an%20inline%20element //Hope this helps you
31st May 2021, 11:29 AM
Atul [Inactive]
+ 1
There are a difference between block elements and inline elements.span is an inline element that can be used with in paragraph tag to markup a text ,but div tag is block element or container for others tags.
31st May 2021, 2:53 PM
HBhZ_C - avatar
+ 1
span allow you to mark and target subpart of block elements without introducing block element (by keeping it inlined)... <p id="my-p-id">my paragraph with <span class="my-span">marked word</span> inside</p> so you could style it specifically with css: #my-p-id.my-span { color: red; } ... and/or target it with js: document.querySelector("#my-p-id.my-span").textContent = "sample text";
31st May 2021, 6:34 PM
visph - avatar