Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Design CSS Centre and Left align Reply To: CSS Centre and Left align

#267704
tobiq
Participant

I don’t know how further to explain this..

I only want the green box centred, and the red box left aligned inside.
setting a width of 80vw is not a solution because the green container is no longer wrapping tightly around the red boxes.

When the red boxes are not overflowing inside the green box, it works fine, because the left align becomes redundant — as the box wraps around all elements on the line. In short, it just looks like the red boxes are centre aligned within the blue body, with a green border.

When they start overflowing, instead of the green box staying centred, while the red boxes overflow in a left-aligned fashion, the green container simply takes up 100% width, and it looks like the green boxes are just left aligned within the blue body, when you ignore the colour of the container.