Can't center text with bootstrap

Can't center text with bootstrap
0.0 0

#1

Hey guys! I’m having a few issues with my portfolio page

  1. When I set a max width to my text inside jumbotron to 550px the text automatically aligns to the left. am I setting the max width attribute in the wrong place?
  2. I’ve tried fixing this by giving my p element an align=center attribute. It didn’t work so I tried it inside the (div class=“container”) section, the (div class=“jumbotron”) and nothing works.
    Again, the problem surfaced after I applied the max width.
    I can’t quite put a finger on it. I’ve googled it and I can’t find anythig about this specific issue.
    Can you guys take a look and see what I’m doing wrong???
    Here’s my link: https://codepen.io/coderafy/pen/yjYjWZ

I put parenthesis instead of <> because it won’t let me post them


#2

You need to make your text a div element instead of a p, that way you can center the whole block… instead of centering each line of text. To center a div, you use margin-left:auto and margin-right:auto and it must have a set width, or max-width property.

.lead {
   max-width: 550px;
   margin: 0px auto;
}

#3

Thanks! It works now :grin: