CSS float:right

问题描述:

我试图在相反的方向上放置两个元素。我偶然发现了一些似乎正在做我想做的事情,但我似乎无法将div放到正确的位置。CSS float:right

有人能告诉我我做错了什么吗?

在下面,我期待节标题是在左边,饲料是右边...

http://jsfiddle.net/n3Dvg/

蒂亚! S.

+0

http://jsfiddle.net/n3Dvg/7/ 放添加!important到#section的宽度(由于工作空间,我使用了400px) 然后我删除了浮点数:left;从#section .section-title,#section添加显示:inline-block属性.feeds 希望它有帮助 – OctoD

嗨现在定义CSSid content

因为这样

#content #section .feeds{ 
float:right; 
} 

Live demo

你有一个在section .section-title, #section .feedsfloat: left这是相互矛盾的。

要么改变那个,要么在float: right之后添加!important

请更正您的造型。写#部分.feeds#section .section-title,#section .feeds覆盖你的风格。

例如这样写:

#section .section-title, #section .feeds { 
float:left; 
      } 
      #section .feeds { 
       float: right; 
       text-transform: none; 
      } 

入住这http://jsfiddle.net/n3Dvg/8/

刚过float:right

#section .feeds { 
float: right !important; // to override any conflict 
text-transform: none; 
}