开发者

How can I add float property properly?

开发者 https://www.devze.com 2023-04-11 05:12 出处:网络
On my page http://s361608839.websitehome.co.uk/pt-build/templatebuild/index.html if you scroll down is a section called pricing. Just below to the right is a div called priceBlock.

On my page http://s361608839.websitehome.co.uk/pt-build/templatebuild/index.html if you scroll down is a section called pricing. Just below to the right is a div called priceBlock.

I'm currently using this css to float it to the right however somehow the div is being pushed onto the next line.

#priceBlock {
width: 206px;
height: 303px;
background: url(../images/prici开发者_高级运维ng-bg.jpg) no-repeat;
float: right;
clear: both;
}

The div is within #pricing and there's enough space in the div to fit it in there without it going to another line.

What do I need to change to my css to make it float to the right but be beside the content inside #leftcol within #pricing?

Thanks


Your #priceblock rule is clearing the float effectively nullifying the needed effect of the float left of #pricing. You can fix this behavior by removing the clear both attribute or specifying clear:right:

#priceBlock {
    width: 206px;
    height: 303px;
    background: url(../images/pricing-bg.jpg) no-repeat;
    float: right;
    clear: right; /*clear: both;*/
    overflow: hidden;
}


In your #priceBlock remove the property clear: both;.

0

精彩评论

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