Align Horizantally CSS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Align Horizantally CSS

I'm trying to align my h1 and paragraph on HTML to the center using CSS. I've read the CSS lesson on it and I'm 90% sure I've typed everything In correctly, but it's still not aligning correctly. Can anybody tell me why? https://code.sololearn.com/WV0l037ibKxo/?ref=app

6th Sep 2018, 2:42 AM
Sir White Cat
Sir White Cat - avatar
4 Answers
+ 2
If this solves your query. https://code.sololearn.com/W1gpl0IbwwGG/?ref=app Hope this helps☺️☺️.
6th Sep 2018, 3:16 AM
Meet Mehta
Meet Mehta - avatar
+ 11
I go along with Janning's response
9th Sep 2018, 7:12 AM
//Fpharbhulourz/>😋😈🤓🇳🇬
//Fpharbhulourz/>😋😈🤓🇳🇬 - avatar
+ 1
There is no need of "body" on CSS. Remove the body and the {}, maintain only the ones from h1.
6th Sep 2018, 2:54 AM
Alexander Santos
Alexander Santos - avatar
+ 1
Your CSS has: h1 {text-align:center;} #Intro {text-align:center;} But #Intro isn't being called/used anywhere by the HTML. (You would want to put id="Intro" in the opening tag of whatever you wanted to apply it to, keeping in mind that you can only use an id once in an HTML file because ids must be unique.) Instead, if you wanted centering to apply to all paragraphs, I would recommend: h1, p {text-align:center;} so that all first level headings and all paragraphs will have centered text. This means article elements will not have centered text.
6th Sep 2018, 5:32 AM
Janning⭐
Janning⭐ - avatar