My Text Won't Center!

My text won’t center. Does anyone know why?

You need to add in codpen settings->css bootstrap 4 or 3 lib

text-center is class of lib bootstrap. without text-align: center

Umm there is no CSS written :joy: :joy:
You can’t center text using HTML. Write the CSS for the class name you used. For example:

h1.text-center {
          text-align:center;
}

Of course you can do this inline too.

<h1 style="text-align:center;">

Oh, I get it now. I’m sorry I just started so I’m kind of clueless. I should probably spend more time learning how to code before building a website. Thanks for all the responses!

1 Like

Haha anytime.

My advice to you (a newbie myself just 4 weeks in) is stick to the steps of your tutorial as much as possible. You won’t conjure that vital missing element out of thin air.

Another thing you can try if nothing else works is in HTML you can add tag
In your case:

<center>
<h1> Steve Jobs </h1>
</center>

Didn’t know you could do that.

You should not use the <center> tag. It is deprecated, and not supported in HTML5:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center

Below is a screenshot form the above link.

2 Likes