Why is <span> being used in this example? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is <span> being used in this example?

<!DOCTYPE html> <html> <head> <title>My Blog</title> <link href="https://fonts.googleapis.com/css?family=Handlee" rel="stylesheet"> </head> <body> <!-- My Skills section start --> <div class="section"> <h1><span>My Skills</span></h1> <ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ul> </div> <!-- My Skills section end --> </body> </html>

6th Feb 2019, 12:10 AM
Cory
Cory - avatar
2 Answers
+ 3
I don't really see any reason. The only thing I can think of is if the person were to come back later and add more text to the <h1> tag, they could do so while also adding a class to the span tag inside so that the text "My Skills" could be styled differently than the other text in the h1 tag.
6th Feb 2019, 12:30 AM
Zeke Williams
Zeke Williams - avatar
+ 3
Well, <span> can be used how other reference in the css: HTML <div class="oneclass"> Hello <span> how are you </span> </div> CSS .oneclass span { font-size: 10px; } And with that modify especify more of your code. You can see more in my codes
6th Feb 2019, 1:14 AM
Jeefry Nicolas Archila Romero
Jeefry Nicolas Archila Romero  - avatar