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 trialScooter D
9,611 PointsCSS Floats Code Challenge 2 classes one div?
I am currently stuck on a code challenge. It asks "It looks like we need to clear our floats. In the HTML file, add the class 'group' to the div with the class 'badge'."
I added class="group" to the div and I get this as an error when I hit check work:
"Bummer! Make sure you added the class 'group' to the div."
<div class="badge" class="group">
<img class="badge-icon" src="flag.png">
<h4>Build a Simple Website</h4>
<p class="badge-desc">Smells Like Bakin' is a cupcake company in need of a website. This project will walk us through the basics of HTML and CSS from the very beginning. HTML and CSS are the structural and presentational building blocks of every website and will serve as the foundation for any web project.</p>
</div>
Im not sure if I can add another class to the same div or if I need to make a separate div/class?
Any help would be greatly appreciated, thanks!
4 Answers
Ibrahim Rodríguez
Courses Plus Student 2,495 Pointshey Scott, if you want to use two classes in a same element just use class="" one time only and separate the two classes by a space. Example:
<div class="dogs cats"><h4>Hello Dog!</h4></div>
I hope that helps!
P.S. sorry for double post, forum is super slow on my end.
Matthew Dunlap
2,655 PointsIf Ibrahim's suggestion does not work you can just replace "badge" class with the "group" class. I just completed this code challenge a few minutes ago and that's how I did it.
Chase Lee
29,275 PointsI was going to reply but it looks like someone beat me to it, by one minute! That was a good reply Ibrahim. Keep it up!
Ibrahim Rodríguez
Courses Plus Student 2,495 PointsThanks Chase! :D Actually I'm really bad at helping out people because I'm still learning, I'm having hard time just positioning a basic design lol but it makes me feel better and confident when I help people.
Scooter D
9,611 PointsThanks for the helps all! After I posted this I actually just made a separate div class and it worked. It's good to know though that I can make two different classes within the same div.
Question on that thought: Which class takes precedence over the other? Common sense tells me the first class in the div but is the thought process really that simple?
Ibrahim Rodríguez
Courses Plus Student 2,495 PointsIbrahim Rodríguez
Courses Plus Student 2,495 Pointshey Scott, if you want to use two classes in a same element just use one time 'class=""' and separate the two classes by a space.
I hope that helps!