Center floated child DIVs in a parent DIV that has fluid width

后端 未结 5 1990
闹比i
闹比i 2021-01-29 06:05

I have the following HTML:

Box1
Box2
5条回答
  •  隐瞒了意图╮
    2021-01-29 06:16

    If your parent element doesn't have a fixed width you can't center his child elements with only CSS. I think you have to write some script that calculate the parent width, every row width and set to them the properly margin-right and margin-left.

提交回复
热议问题