Forums

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

Home Forums CSS Center Div and Content

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #288818
    Taz
    Participant

    So I’m posting this in CSS because I think I’m having a CSS issue. Basically, I have this right now: https://taziamoma.com/Forum/

    I’m trying to vertically center the blue box and everything inside it. I’ve tried line-height, vertical-align, display: inline-block, position relative and absolute. The only way that works is if I do it manually with absolute or margin. But absolute isn’t responsive so that’s a problem. I’m using Bootstrap from the CDN if that matters. I’m only going to include code for the first box so that it doesn’t get messy. 

    I’m having a tough time even centering the text vertically.
    The code is here.
    https://codepen.io/Taziamoma/pen/eaXpoL

    #288851
    uxfed
    Participant

    I’d suggest removing float styles from the blue box and its siblings. Then apply display: flex and align-items:center on its parent element. If you’re using Bootstrap 4 you could use the classes “d-flex align-items-center”.

    #288858
    Taz
    Participant

    That worked beautifully, thank you so much.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.