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 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!
hey 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.
If 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 Lee29,275 Points
I 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!
Thanks 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?