2012-11-28 16 views
0

我是新的我不知道更多关于代码。我想要一个链接左侧的块和其他链接右侧。我正在使用下面的命令。两者都在正确的方面,但在新的一线。我已经在CSS中给出了正确的代码,但我认为一些HTML代码问题。请让我知道下面的错误。文本对齐不在同一行上工作

 <div class="more"> 
     <span><a href="http://www.fe.com/discuss">See More</a></span> 
     </div> 
     <div class="placeadhere"> 
     <span><a href="http://www.fe.com/posting.php?mode=post&f=16">Place Ad Here</a></span> 
     </div> 

我的CSS是

.more { 
font-size:11px; 
text-align:right; 
margin:5px 0 10px 0; 

}

.placeadhere { 
font-size:11px; 
text-align:left; 
margin:5px 0 10px 0; 

}

图像是 enter image description here

非常感谢你我的PROBLE M解决你的答案...爱你和SOF ..

+2

添加你的CSS ... – Sowmya

+0

我加入CSS代码也。请检查它..谢谢.. – user1820652

+0

你有一个jsFiddle吗? – starbeamrainbowlabs

回答

0

我认为问题是你的CSS。你也应该粘贴它。

<div class="more" style="width:auto; float: left;"> 
     <span><a href="http://www.fedri.com/discuss">See More</a></span> 
</div> 
<div class="placeadhere" style="width:auto; float: right;"> 
     <span><a href="http://www.fedri.com/posting.php?mode=post&f=16">Place Ad Here</a></span> 
</div> 
+0

很多答案都工作....非常好的朋友非常感谢你...爱你和SOF .... – user1820652

0

DIV的是元件和将占据整个宽度。指定div为内联,以便它只占用所需的宽度。或者你可以让你的div的定位为绝对,并根据需要浮动它们。

.more { 
display: inline; 
    float: left; 
    font-size: 11px; 
    margin: 5px 0 10px; 
    text-align: right; 
} 

.placeadhere { 
display: inline; 
    float: right; 
    font-size: 11px; 
    margin: 5px 0 10px; 
    text-align: left; 
} 

见工作fiddle- http://jsfiddle.net/bkgJT/

+0

cdeez请你能让我知道代码..我不知道更多。 – user1820652

+0

查看链接中的演示。希望能解决你的问题。 – Cdeez

0

您可以在http://cssdeck.com/labs/tztgz6hy/0

工作看到这个我增加了一个额外的div围绕整个HTML片段应该像

<div class="main"> 
    <div class="more"> 
     <span> 
      <a href="http://www.fedri.com/discuss">See More</a> 
     </span> 
    </div> 
    <div class="placeadhere"> 
     <span> 
      <a href="http://www.fedri.com/posting.php?mode=post&f=16">Place Ad Here</a> 
     </span> 
    </div> 
</div> 

和CSS

.more { 
font-size:11px; 
text-align:right; 
margin:5px 0 10px 0; 
} 
.placeadhere { 
font-size:11px; 
text-align:left; 
margin:5px 0 10px 0; 
} 
.main .more{float:left;} 
.main .placeadhere{float:right;} 
+0

很多答案都工作....非常好的朋友非常感谢你...爱你和SOF .... – user1820652

0

使用这种自定义的div宽度

<div style="width:somevalue"> 
     <div class="more"> 
     <span><a href="http://www.fedri.com/discuss">See More</a></span> 
     </div> 
     <div class="placeadhere" style="float:right;"> 
     <span><a href="http://www.fedri.com/posting.php?mode=post&f=16">Place Ad Here</a></span> 
     </div> 
    </div> 
+0

很多答案都工作....非常好的朋友非常感谢你。 ..爱你和SOF .... – user1820652

+0

@ user1820652请记住,你可以upvote帮助你的答案,并通过选中最好的答案。 – Cdeez

0

只需添加float

.more { 
font-size:11px; 
text-align:right; 
margin:5px 0 10px 0; float:right 
} 

.placeadhere { 
font-size:11px; 
text-align:left; 
margin:5px 0 10px 0; float:left 
}​ 

DEMO

相关问题