Why use divs?


#1


Hi, I have question regarding this exercise:

https://www.codecademy.com/pt/courses/make-a-website/lessons/site-structure/exercises/add-div

It's not that my code does not function I just don't understand why do we use divs and what really are divs.

Thanks :slight_smile:

Replace this line with your code.


#2

Hi @sofia150 ,

divs are containers that carry a minimal amount of baggage, in contrast with other more complex elements, such as tables. In this regard, divs offer the web page designer the flexibility to use them to group HTML elements, and to style them from scratch, using CSS. They are like a blank slate that you can style as you please.


#3

So let me see if i understood it: they are like little boxes where you put stuff and design them the way you want it (like colours and size)?

And thank you for answering my initial question!


#4

Yes, and as you'll see later on, there are many additional factors that you can control, including margins, position on the page, alignment of text, and the pattern, thickness and colors of borders.