Why should we use divs if they don't change things visually?


#1

I don’t see any visual or sectional changes to the text when I add the <div> tags. Is there supposed to be some change in appearance? If not, what’s the point of this exercise if we cannot see the changes take place during the <div> exercise?


FAQ: Learn HTML Elements - Intro to HTML - Divs
FAQ: Learn HTML Elements - Intro to HTML - Divs
#2

div (short for division) allows us to divide our page into different sections, to position this sections. Divs are very useful. The change might not be the most visual one, doesn’t make it less useful.

if we only used text, everything would just be from top to bottom. Look at this forum, imaging where divs might be (to divide different replies for example), or to place the scroll bar on the right hand side of the page and staying there even though we are scrolling through the replies.


#3

Thanks for the thorough explanation! I understand the utility of div now, even if the visual changes aren’t readily apparent.


#4

Which implies a border or horizontal rule.

Short for division, implies a container.

DIVisions have no height, but come with width: 100% by default. Their height grows automatically as content is inserted. They can be set to a fixed height that triggers a scroll bar when the content overflows the allowed container size.


#5

Thanx for this reply, it’s helped to increase my undertanding of the “div” tag


#6

Thanx mtf for this angle of explanation concerning “div” tags. am really learning… yaaayyy