开发者

CSS float: left layout moves

开发者 https://www.devze.com 2023-04-11 08:35 出处:网络
This is the css file for two division one at left and one at right=> div#id_div_loadwhat { float: left;

This is the css file for two division one at left and one at right=>

div#id_div_loadwhat {
    float: left;
    width: 74%;
    padding-right: 5px;
}

div#id_div_rightside {
    float: left;    
    width: 25%;
    height: 100%;
    border-left:solid thin #ff9900;
    margin-right: 0;
    padding-right: 0;
}

When there is no text or data in left side division the right side division moves to the left.

But i want to right side division at it's right side position for 开发者_运维技巧all time.

How can i do this ?


"When there is no text or data in left side division " --> Just don't let the "left side division" empty, just put a " " inside it.


If you just want to keep the left div "absolutely empty" as it is, just apply css rule "min-height" to it with a small value:

div#id_div_loadwhat {
    float: left;
    width: 74%;
    padding-right: 5px;
    min-height:18px;
}


what you need is to specify the height on the left div.. either with a min-height or height

this will solve your problem..

and one more thing, the padding-right should be 1% not in 5px because it will miss your style when the resolution is small.


Give the right side div float:none and see if that works.

0

精彩评论

暂无评论...
验证码 换一张
取 消