0

我试图将几个 div 相互对齐,由于某种原因它不起作用。我使用一个简单的引导模板...我的代码片段如下,我的 JS 小提琴是http://jsfiddle.net/sean3200/yU3TA/ 谢谢!!

     I basically want my html to look like align such as:
     Album1: Name1
     Album2: Name2

    <div id="wellbox" class="well pull-right">
        <div><h3>Album Sales & Net worth</h3></div>
           <hr>
        <a href="#"><p id="album0">Album1:</p></a>
             <div><p id="albumdata0" class="album-class">Name1</p></div>

        <a  href="#"><p id="album1">Album2:</p></a>
             <div><p id="albumdata1" class="album-class"></p>Name2</div>

        <a  href="#"><p id="album2">Album3:</p></a>
             <div><p id="albumdata2"  class="album-class">Name3</p></div>

        <a  href="#"><p id="album3">Album3:</p></a>
             <div><p id="albumdata3" class="album-class"></p></div>
    </div>
4

1 回答 1

0

我可能会这样重组:

<div id="wellbox" class="well pull-right">
    <div><h3>Album Sales & Net worth</h3></div>
       <hr>
    <div class'albumContainer'>
        <a href="#"><p id="album0">Album1:</p></a>
        <div><p id="albumdata0" class="album-class">Name1</p></div>
    </div>
</div>

然后我会添加以下样式:

.albumContainer{
    clear: both;
}
.albumContainer a, .albumContainer div{
    display: inline-block;
}
于 2013-06-05T20:40:56.273 回答