简体   繁体   中英

prevent div moving on window resize

I have a page with two divs "list_events" and "right_content" one next to each other. When I resize the window "right_content" moves down "list_events" but i dont want that! I dont want those two divs to move neither to scale down on window resizement..how can I achieve that?

this is the code

.list_events{margin-left:1em;float:left;}
.right_content{float:left;margin-left:1em;}

thanks Luca

first add a parent div/wrap and put those two divs of yours into it.

like so:

<div id="wrap">
   <div id="list_events"></div>
    <div id="right_content"></div>

</div>

then you can try the

min-width(px/ems/ etc) on the parent/wrapper div like so:

#wrap{
min-width: 600px;
}

Overall, whatever size you add to the min-width itll scale the parent div down to the size specified.

once the window is sized down past your specified size, itll behave like any other window.

this is my way of doing it.

您可以将此div放在具有固定宽度/高度的父div中,或者您可以确定每两个div的百分比宽度/高度。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM