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 trialJeremy Yochum
Front End Web Development Techdegree Graduate 16,023 Points.form-contact works fine, but [class="form-contact"] is not working for me
Hey, I was wondering if anyone can help me with this. I cannot seem to get this code to work
[class="form-contact"] {
padding: 20px 24px;
background: #f4f7f8;
}
It is the only code that I have in the stylesheet. I have also cleared the cache and hard reloaded the page, but it does not work for me.
On the other hand, when I use
.form-contact {
padding: 20px 24px;
background: #f4f7f8;
}
Everything works fine, so the stylesheet is linked correctly. I feel like it is something very simple that I am missing, but it is keeping me from being able to move forward, so any help is appreciated.
1 Answer
Jeremy Yochum
Front End Web Development Techdegree Graduate 16,023 PointsSo, I have figured out what happened. I do not understand why this would be the case, but in the HTML provided with the workspace there was another class name included with the class attribute for the form.
<form class="form-contact br">
I did not include the "br" class name in the original code, but when I added it to the attribute selector in my CSS it works as intended. This syntax worked for me:
[class="form-contact br"] {
padding: 20px 24px;
background: #f4f7f8;
}