html - Trying to float three vertical boxes to the right of one large box -


i working on html / css trying lay out correctly, cant understand why wont work.

i want have 1 large main area , 3 vertically stacked smaller areas right of - on narrower page, 3 boxes wrap underneath main area.

i have following code, think should work, lets 1 of smaller boxes show @ side - other 2 stay underneath main box, , dont understand why!

my code test code try , working, , follows:

<div style="width:650px; height:900px; margin:25px; display:inline-block; background:yellow;"></div>  <div style="width:250px; height:250px; margin:25px; display:inline-block; background:blue;"></div>  <div style="width:250px; height:250px; margin:25px; display:inline-block; background:blue;"></div>  <div style="width:250px; height:250px; margin:25px; display:inline-block; background:blue;"></div> 

all css inline, simple test.

this give following layouts, depending on browser width.

on wide window, expect 3 boxes stack right...

enter image description here

and on narrower window...

enter image description here

this expect. first layout, when window wide enough divs show side side, expect 3 blue boxes stack vertically.

can see why doesnt work expect?

the float property might cumbersome use force alignment you're looking for. re-did code using display: flex , other flex-specific properties. check out working pen.

basically, need wrap 3 small divs in div. apply display: flex wrapper div, , outer div holding (in pen, did whole body). then, aligned, can use justify-content: center on both outer div (e.g. body) , inner div holding 3 blue squares.

if you're not familiar flexbox, mdn has a tutorial.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -