Containers vs. Divs

Hi guys,

I have a general question regarding webflow “containers”. It is my understanding, that in the past, containers were exclusively 940px max-width, which at some point was not doing the trick for some users. That’s why many did not use containers but rather define their own div-blocks with a custom max-width + horizontal centering.

Now that containers can have any custom max-width definition, is there still any reason not to go with a container?

Thank you for your answer!
Mike

1 Like

@Mike15 because the container element has a set margin of auto on the left and right which you can’t change. Another thing for example is some people may want a container that has weird horizontal positioning and that is where the div block comes in.

Let me know if you need further clarification.

1 Like

hi @Mike15 that’s correct. The container is just predefined element you can customise but there is no reason to use it as it is standard div element. I personally never use predefined elements as I do not see benefits of rewriting applied styles while you can start with clean table. You can always set div to semantically correct HTML component from menu (viz. options on right side)

1 Like

Got it, thank you for your answer!

Maybe one last question from my side. A container in webflow is simply a div with a default max-width of 940px and center alignment by margin-left/right auto, correct? Or are there any other definitions that i am missing right now?

Another thing to note is that you can’t place a container element inside a container element @Mike15.

1 Like

AoA.
If you want to now more about Div vs Container then check the videos on webflow university.

At the end of the day, a Container element has some presets that might save us time. Internally at Webflow, we often use custom Div blocks, but Containers are perfectly valid and many of us use them as well. :sunglasses:

3 Likes

I would like to just add some info if someone wonder about why is set width of container to 940px.

940 or 960 px has become a “standard”, because for a long time It was unusual to see screens larger than 1024x768px. Thus 940px or 960px, was a good choice to put our content. It allows whitespaces either side and it gets divided nicely into columns if needed.

This is from article from 2014. I can imagine that a few people still may use this container as it suit to their design but generally since 2014 screens get only bigger. IMHO set max width 940px as STANDARD in 2021 in most design cases is not practical and the “advantages” of WF container are questionable.

m2c