Forums

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

Home Forums CSS [Solved] Centering Titles in Columns

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

    Here is my codepen: http://codepen.io/anon/pen/iAJrE

    I’m attempting to find a way to center the title both vertically and horizontally. I’m also attempting to remove the right margin when the screen is resized @850px.

    Any help?

    #180511
    nixnerd
    Participant

    Do you know the size of the tiles? Will you always?

    #180512
    Paulie_D
    Member

    Here…this solves the centering issue. I’m not sure why you have a span in a span but I’ve left that.

    http://codepen.io/Paulie-D/pen/vkiHu

    #180513
    nixnerd
    Participant

    @Paulie_D: A span inside a span is a common technique in recursive CSS. Very popular right now.

    #180514
    Paulie_D
    Member

    Actually, my guess is that the ‘span in a span’ was a holdover from trying to use CSS tables to center the inner span.

    Obviously, it’s not necessary here for centering although it does allow us to put a color overlay on the image.

    #180526
    nixnerd
    Participant

    I was just joking.

    Yeah, OP, there are lots of ways to center a photo or anything really inside a container. As long as you’ll ALWAYS know the size. For theme development, it gets more tricky because you have no idea what someone will upload. That’s where flexbox is pretty handy.

    At any rate, what framework/grid system is this? It does not look like you wrote it.

    #180528
    nixnerd
    Participant

    @Soronbe:

    I actually just used this technique and it works absolutely fine. However… the containers are the problem. If you have a container with styling… like a background color, they won’t all be the same height. That’s something that either requires Flexbox OR some JS.

    Sorry… I was a tad vague on that.

    #180529
    siouxfan45
    Participant

    @NIX This is my own system, I wrote it.


    @Paulie_D
    Thanks! The span is a leftover as I tried a few different approaches to get to this point.

    I won’t always know the size of the image.

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