Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS List vertical align

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #33072
    aoeui
    Participant

    hi,

    ashamed to ask so basic question

    how can I vertically align text
    so it is in the middle of list item
    whic is img ?

    see screenshot (small img 117×137)
    http://krsiak.cz/temp/list-align-vertical.png

    #73527
    chrisburton
    Participant

    If I understand correctly, it will automatically be vertically aligned since by default they are block level. If you wanted them to be horizontally aligned, you would add inline to the display property.

    Click preview

    #73528
    aoeui
    Participant

    not if you have IMG higher than text

    #73529
    chrisburton
    Participant

    ok then I misread what you were saying. Use the line-height property to adjust where the image lays next to the text.

    #73530
    chrisburton
    Participant

    Actually, if you can post just the PDF image, I’ll help you further.

    #73532
    Clayton
    Member

    Are you asking how to align the text and the PDF icon horizontally?

    Meaning, the image you uploaded is what you DONT want the final layout to look like?

    If so, you can mess around with margins, line-heights, positioning, etc. There are hundreds of different ways to get two elements to line up vertically, or horizontally.

    I can mark it up for you, and add CSS, if you’d like. After yoga however :)

    Have a great morning!

    #73517
    chrisburton
    Participant

    Use pseudo :before for the image and add line-height to adjust it. Again, if you give me the pdf icon image, I can help you further.

    #73505
    chrisburton
    Participant

    • Number 1

    • Number 2

    • Number 3



      ul { display: block; }

      li {
      background: url(http://krsiak.cz/temp/test/pdf.png) no-repeat;
      height: 32px;
      line-height:32px;
      list-style: none;
      padding: 0 10px 10px 0;
      }

      li span {
      font: normal 15px "Arial", Sans Serif;
      color: #367588;
      line-height:32px;
      list-style: none;
      padding-left: 40px;
      }
Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘CSS’ is closed to new topics and replies.