Forums

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

Home Forums CSS centering with flexbox

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #268513
    icewizard
    Participant

    I am trying to center a child div inside of a flex div. I used justify-content: center on the parent element, and on the child element inside the flex element I used justify content: center. the child div that I want to center is nearly at the point I want it at, but I want it a few pixels higher. Is there anything in the flexbox commands I can use to make my element a little higher, rather than just justify-content: center?

    #268516
    Paulie_D
    Member

    We’ll need a minimal Codepen.io demo to see what’s what but would point out that something is either centered or it’s not.

    A “few pixels higher”…is not centered…so you are obviously going about this the wrong way.

    #268577
    icewizard
    Participant

    I just used a top: 8em, to make the element go down more vertically. I have another problem though. I am making a table with rows and columns, but I don’t want them to expand when I add text content. I have tried overflow: hidden, table-layout:fixed, but nothing seems to be working. When I add text, the td and tr elements expand where that row of text is. How do I prevent this? Here is a link to my codepen https://codepen.io/icewizard/pen/XEMmGZ

    #268591
    Paulie_D
    Member

    Then I’d suggest NOT using a table.

    If want things to not work like table…don’t use one.

    Try fixed widths divs instead.

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