0
What is the function of span
Span in css
3 odpowiedzi
+ 3
https://www.w3schools.com/tags/tag_span.asp#:~:text=The%20tag%20is%20an,span%3E%20is%20an%20inline%20element
//Hope this helps you
+ 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.
+ 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";