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

Home Forums CSS I cant center the div

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #260630

    I have div inside of another div and I cant align it in the center horizontally. I thought that displaying the “LEXIGTON AVE. LOS ANGELES” block as inline-block and adding margin: 0 auto to it would do the job, but it doesnt. I basically want this text to be in the middle (only horizontally) Thanks!


    Elements with display:inline-block act like text and are centered by applying text-align:center to their parent element.

    However, since you are using flexbox, the display property you are using is essentially ignored and centering of that would be achieved by applying justify-content:center to the parent.


    Wow, you are a great guy! Really helped me with understanding of the code. I am really trying to understand it myself but sometimes I just do not know where am I mistaken. Thanks a lot Paulie_D!

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