Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS How to Make a Website CSS: Cascading Style Sheets Take a Mobile-First Approach

David Norton
David Norton
2,762 Points

Centering 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

Use 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
Hernan Martin Demczuk
1,264 Points

The 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.

try: margin: 0 auto;

David Norton
David Norton
2,762 Points

index.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
David Norton
2,762 Points

When 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
David Norton
2,762 Points

I 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
Pavle Lucic
10,801 Points

Maybe you didnt refresh your page, or didnt save the file...

David Norton
David Norton
2,762 Points

I 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
David Norton
2,762 Points

After using to Chrome it worked.