Direction And Spans

DIV AND SPAN...

·

2 min read

Direction And Spans

I am sure you are wondering what direction this baby-dev is talking about, i haven't written anything on this blog since the last time i talked about my whole learning struggle, If you haven't read that please check my blog to do that. This will be a simple and easy one.

So i have been learning again from the scratch but not the whole scratch. lol! i decided to go through HTML elements that i'm not familiar with and found very difficult to work with them on a web page, yeah div and span really was in my pants for months, days and night. it's funny how div is a block element and it decided to block my head. i watched a video on youtube(minim channel- check them out on youtube especially if you are self study developer like me) about the differences between div and span so now i can talk about it because i know the direction.

DIV- is a generic container for flow content. it has no effect on the layout except it's styled with CSS. it is a block element. it is used to group content so it can be easily styled using class and ids(we would come to this soon).

<div>
<h1>Rosemary's journey</h1>
<p>we are learning div today</p>
</div>

SPAN- is a generic inline container for conveying of content. Which does not inherently represent anything. A span can put inside any HTML element .

<p>Rosemary's blog is really<span>an amazing piece</span> to read.</p>

The both are generic elements in HTML. Just that, a div is a block element and a span is an inline element and they have different function to play when building a web page, div cannot be attach inside a span because it will not work. so instead you attach a span to a section of a web page.