The Div and Span Tags

20 May 2019

Sometimes you want to give particular bit of text a different style, or seperate it from the rest. Well, you would have to use the DIV tag or the SPAN tag, the DIV tag is used to group lots of different text inside several tags. The span tag is used to select text inside one set of tags. You would use the tags like this:

 
>style< 
.life  {
  color: red;
}
<p>A dog is an interesting type of animal they enjoy doing several things:
<span class="life"> Eating, smiling, loving, walking etc. </span> >/p<

You would use the div tag in the same way just around several tags like a h1 tag and a p tag. The code above would look like this

A dog is an interesting type of animal, they enjoy doing several things: Eating, smiling, loving, walking etc. Please don't hesitate to ask questions, we love hearing from you! Tell us how much you love Learn To Code! Send us your projects, but BEWARE the text limit is 500 words so you may need to send it in several parts!

NEXT POST →

Any Questions?

Any Questions?