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 trial
James Parker
3,133 PointsWhy is there no change to the text?
Hi I have added a class to the two H2 titles;
<h2 class="card-style">Background</h2> <h2 class="card-style">Goals</h2>
and put the following in CSS:
.card-style { text-align: center; }
But when I refresh there is no change to the titles in the web page. I have tried changing the position of the above in CSS but nothing seems to work
What am I doing wrong?
Thanks
6 Answers
Jennifer Nordell
Treehouse TeacherHi there, James! First, I'm glad you got it working! Going forward, it's a good idea to note that if you're fairly sure that your code should work, but you're not seeing any changes... always check the basics. Make sure you've saved the file. I know that sounds silly, but we've all fallen victim to that one! If you still don't see a change, try refreshing the page.
But the most likely culprit here (given that it works in one browser and not the other) is your browser cache. It is loading up a previous version of your code instead of your newly altered code. You can either clear your browser cache if you suspect this to be the problem, or you can launch it in a new private browsing tab. Either way will result in you getting the new version of your code as opposed to an older version.
Happy coding!
Raulis Pranckevicius
1,894 PointsYour code is correct, theres no problem with it. Just did a small test now. Have a look if you have linked your .css file in the <head> ellement like so.
"<link rel="stylesheet" type="text/css" href="styles.css">"
James Parker
3,133 PointsThanks for the response, I double checked and I have the below in the <head>;
<link rel="stylesheet" type="text/css" href="styles.css">
the css file is called "styles.css"
Really strange - I just used Edge instead of Chrome and the code worked - is this normal?
Raulis Pranckevicius
1,894 PointsI did the test using sublime text software and chrome. All was good. It's a simple code so all browsers should show it the same. Have a look in your styles.css if there's any code that is trying to cancel out your text-align: center; or in any way interrupt it.
sorry for any grammar mistakes!
James Parker
3,133 PointsVery strange! Will hopefully get to the bottom of it, it's good to know the code is correct.
Thanks for your help :-)
James Parker
3,133 PointsThat sorted it out - thanks!