- This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I was using “inner” as a child div with a padding of 20px.
The issue is, when I float an element to the left and the second element to the right the “inner” div totally collapses.
Acts as if there is no padding at all…
I’d have to add a second class attribute named “clearfix” just so the parent div can expand to fit all of it’s content…
I find it quite annoying to repeatedly add “clearfix” to every single div that needs the padding…
I also use 2 divs named “left” and “right” that obviously float left and right.
What can I do to fix this?
Please, Help.
[Fiddle](http://jsfiddle.net/WV3qv/2/ “http://jsfiddle.net/WV3qv/2/”)
@Atelierbram What exactly is flexbox?
> What can I do to fix this?
You could also look into `inline-block`.
http://joshnh.com/2012/02/07/why-you-should-use-inline-block-when-positioning-elements/
>I was using “inner” as a child div with a padding of 20px.
On thinking about it….Why? Can’t you add the padding to the header?
I like Paulie’s idea, or you could simply add overflow: hidden; to the padded child and not need to add a class every time.
@paulie_d I wanted the padding inside of specific divs without expanding the parent….
http://caniuse.com/#feat=css3-boxsizing
Pretty much all browsers yeah ^^