Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
136 views
in Technique[技术] by (71.8m points)

Vertically Misaligned CSS Columns

Code: http://cssdeck.com/labs/aqhndehk

I'm creating a page that displays album information. What I want to do is list all of the songs using an ordered list in CSS columns, but when I do so the first column is almost one item lower than the second column. I've attepted the fixes in this thread to no avail. Is there way I can fix this using CSS/HTML?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Give column-count on on ol not div

Check this snippet

.album_container
{
    background: rgba(0,0,0, 0.75);
    position: relative;
    top:0;
    padding-bottom: 250px;
    margin:0;
    margin-bottom: 100px;
    margin-right: 30px;
    left:18px;
}

.album_image
{
    opacity: 1.0;
    position: absolute;
    left: 5px;
    color: #ddd;
    background: rgba(0,0,0, 0.85);
    line-height: 0;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    border-radius: 10px;
}

.album_image img{
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.album_image h4
{
    line-height: 0;
    margin-left: 5px;
    font-family: "Roboto", "Lucida Grande", Verdana, Arial, sans-serif;
    font-size: 12pt;
}


.album_image h5
{
    line-height: 0;
    font-style: italic;
    margin-left: 5px;
    font-size: 12pt;
}

/*.album_songs
{
    font-family: "Roboto", "Lucida Grande", Verdana, Arial, sans-serif;
    margin:0;
    position: absolute;
    padding-top: 0px;
    left: 270px;
    padding-right: 600px;
    line-height: 0;
    color: #ddd;
    font-size: 12pt;
    top: 0;
    padding-bottom: 210px;
    column-count: 2;
    -moz-column-count: 2;
    column-width: auto;
    column-fill: auto;
    height: 210px;
}*/

.album_songs{
   position: absolute;
   padding-top: 0px;
   margin:0;
    position: absolute;
    padding-top: 0px;
    left: 270px;
  
}
.album_songs ol{
column-count: 2;
    column-gap:50px;
}
        <div class="album_container">
          <div class="album_image">
            <img src="http://got-djent.com/sites/default/files/imagefield_default_images/placeholder_0.png" height="250" width="250">
            <h4>Unknown Album</h4>
            <h5>Unknown Artist</h5>
          </div>
      <div class="album_songs">
      <ol>
      <li>a</li>
      <li>a</li>
      <li>a</li>      <li>a</li>
      <li>a</li>
      <li>a</li>
      <li>a</li>
      <li>a</li>
      <li>a</li>
      <li>a</li>
      <li>a</li>
      <li>a</li>
      <li>a</li>
        <li>a</li>
        
        <li>a</li>
        
        <li>a</li>
        
        <li>a</li>
        
        <li>a</li>
      </ol>
      </div>
    </div>
        

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...