Block and Embedded Percentage Display
I am creating a layout with header, nav, main content and footers. There are numerous divs inside each section. I am trying to get the content of a div to stay inside each element and have each element stack on top of each other. Do I need to use display: block to stack these elements? I've tried display: inline-block and they don't stack properly.
+3
flasshy
source
to share
1 answer
Block-level elements span the width of their container and clear on both sides, so yes, you will need to use display: block;
(or use block-level containers such as div
, p
etc. to achieve this stacking.
+2
trnelson
source
to share