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 trialAurelian Spodarec
7,369 PointsHTML class attribute errors [SOLVED]
Whats wrong with my code???
Add a div around the featured-cupcake element, and give it the classes container and clearfix. Bummer! Your new div is missing a class. It's supposed to have both 'container' and 'clearfix' as classes.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Smells Like Bakin' Cupcake Company</title>
<link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen">
</head>
<body>
<div class="container" class="clearfix">
<div id="featured-cupcake">
<h2>Cupcake of the Week</h2>
<img src="img/featured-cupcake.jpg">
</div>
</div>
</body>
</html>
Aurelian Spodarec
7,369 Pointsit did work, but is that me or that question is set bad?
Dustin Matlock
33,856 PointsShen JIE LIN, if you want to receive credit for helping out, you can add your response as an answer at the bottom of the page.
Shen JIE LIN
10,612 PointsHi, Aurelian
Since it did work then I'll go ahead and explain the problem in your coding.
pay special attention to this line in your code.
<div class="container" class="clearfix">
Note how you used class attribute twice, when you wish to denote two different class to the same div or any other HTML elements, the proper way is to simply separate them with a space as the following
<div class="container clearfix">
I hope this explanation helps you, and if you understood please rate best answer, if not then ask any questions you like and I'll try my best to answer you. :)
Hey Dustin Matlock I just saw your posting, I actually don't know how to add my response as an answer, I thought simply commenting below the posting, and have the poster rate my answer as best answer is good enough?
Shen
Aurelian Spodarec
7,369 Pointsaaa so no need to write class twice ? insted of that just separate it with a space? wow i didnt know that , its good that i camed back so see all the undone HTML challenges i did time ago . Im going throw HTML courses and see if i an do stuff i coudnt do then .Thank you ;:)
Shen JIE LIN
10,612 PointsGlad I was able to help, Aurelian Spodarec :)
1 Answer
Shen JIE LIN
10,612 PointsHi, Aurelian
Try the code below, and see if it works for you. If not let me know.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Smells Like Bakin' Cupcake Company</title>
<link rel="stylesheet" href="css/normalize.css" type="text/css" media="screen">
</head>
<body>
<div class="container clearfix">
<div id="featured-cupcake">
<h2>Cupcake of the Week</h2>
<img src="img/featured-cupcake.jpg">
</div>
</div>
</body>
</html>
Shen
Shen JIE LIN
10,612 PointsAHHHHH, this is how you post answers LOL. okay, thanks Dustin Matlock
Aurelian Spodarec
7,369 PointsWhen you post answer, people can up vote it or down vote it depending if it was useful and as a best answer is for people that if they look for it , they will see it and know its right . bdw how should i name this so if somebody ever runs in the same problem could find that easy? maybe question that its asked ? this " Add a div around the featured-cupcake element, and give it the classes container and clearfix. " so if somebody paste it this will pop up ?
Shen JIE LIN
10,612 Pointsthat is hard to say since when people is having problems with their code sometimes they do not necessarily know where the problems occur, I guess changing the name to something like "HTML class attribute errors" would increase search chances.
Aurelian Spodarec
7,369 Pointsdone ! Hope it helps other too :)
Shen JIE LIN
10,612 PointsShen JIE LIN
10,612 PointsHi, Aurelian
Try the code below, and see if it works for you. If not let me know.
Shen