简体   繁体   English

右对齐div与左对齐div内联?

[英]Right aligning div inline with a left aligned div?

I am experiencing difficulties when I am trying to Right align text links inside a div. 尝试在div中右对齐文本链接时遇到困难。 I'm not sure what I am doing wrong. 我不确定自己在做什么错。 But this is the code for the div that is supposed be right aligned: 但这是div的代码,应该正确对齐:

 <div class="menu">
     <a href="http://google.com" class="button">Home</a>
     <a href="http://google.com" class="button">Sign In</a>
     <a href="http://google.com" class="button">Join The Crowd!</a>
 </div>

And all the code is here: http://jsfiddle.net/GSfmf/1 所有代码都在这里: http : //jsfiddle.net/GSfmf/1

I am wanting the buttons still vertically-centered in the header_div, but aligned to the right. 我希望按钮仍在header_div中垂直居中,但要向右对齐。 And anything that I do doesn't move it. 而且我所做的任何事情都不会动摇它。

Thanks, sorry for being foolish about the css. 谢谢,很抱歉对CSS感到愚蠢。

Take out display table from your header div. 从标题div中取出显示表。 Is there a reason your displaying it as a table? 您将其显示为表格是有原因的吗?

Works fine when you take out display header 取出显示标题时,效果很好

div.header_div{
    background-color: #ffffff;
    padding: 15px 50px 15px 50px;
}

在CSS样式表中,只需添加以下代码...认为它可以工作.menu {float:right;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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