Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Norton
2,762 PointsCentering Logo Does Not seem to work as video indicates. I am sure I have done something wrong but can not see the issue
This is my html selector id code<a href="index.html" id="logo"> <h1> David Norton</h1> <h2> Consultant</h2> </a> This is my main.css file
logo {
text-align: center; margin: 0; }
After saving it the logo is not centered. What should I do?
10 Answers
jne
12,613 PointsUse the markdown cheatsheet for right reference on how to paste code on here. Indent 4 spaces for your code and it's right formated adn jump on a new line with your code like:
//Skip one line 4 spaces before code 4 spaces before code 4 spaces before code
Hernan Martin Demczuk
1,264 PointsThe problem is that you didn't put the # before the selector to tell CSS that you are talking about an identifier in the HTML document. Only HTML tags like div, h1, header,etc. don't require any "#" or "." before you invoke them.
Pavle Lucic
10,801 PointsCould paste HTML?
jne
12,613 Pointstry: margin: 0 auto;
David Norton
2,762 Pointsindex.html <header> <a href="index.html" id="logo"> <h1> David Norton</h1> <h2> Consultant</h2> </a> Main.css
logo {
text-align: center; margin: 0; }
David Norton
2,762 PointsWhen I copy the code an place it this container it is not publishing the same way as I have copied and pasted the code.
David Norton
2,762 PointsI do not know what happened but it is now functioning properly. I made no changes to the code and I did not save anything. This sort of happened before as well. Do not understand what is happening.
Pavle Lucic
10,801 PointsMaybe you didnt refresh your page, or didnt save the file...
David Norton
2,762 PointsI just had another problem similar. I have been using Safari, I am going to switch to Chrome to see if that makes a difference.
David Norton
2,762 PointsAfter using to Chrome it worked.