简体   繁体   中英

Div keeps wrapping when browser size shrinks

How do I stop a div from wrapping/moving below when the browse is resized to the left. everything else on the page stays still except this one box. I want it to not move and force the user to use the browser left right scroll to view it.

#signup_box {
    width: 363px;
    height: 392px;
    float: right;
    margin-right: -34px;
    min-width: 363px;
}

You're floating it. It will wrap. Try positioning it manually, something like:

#signup_box {
    width: 363px;
    height: 392px;
    position:absolute;
    right:34px;
    top:0px;
    min-width: 363px;
}

You have floated the div using float: right; , so it will adjust its position ("float") as necessary.

You can remove the float to stop this behavior, and ensure your page is wide enough to accomodate the width of this (and other relevant) elements.

尝试overflow: scroll

No, There is a simple way to do this...It can work but it is css3. But you can try:

div {
white-space: nowrap;
}

Please reply if it works for you! Thanks! By the way, It will only work if you put it in all elements or just put it in a container. This way, you can put in float without it wrapping

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