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

CSS

Jeremy Coleman
Jeremy Coleman
5,449 Points

HTML Form and ID attribute issue

          <form action="" id="contact-me">
            <label for="firstName">First Name</label>
            <input type="text" name="firstName" value="First Name">
          </form>
      #contact-me {
        background-color: red;
      }

This does not work for some strange reason, however if I switch the id to class, and the id to class selector it works just fine. Although I found a alternative solution, I am a little confused to why the id selector isn't working. Thank you in advance!

2 Answers

Tommaso Poletti
Tommaso Poletti
5,205 Points

Should all work you have nothing wrong.

If you have external CSS controls that you do not overwrite your rule

Kevin Korte
Kevin Korte
28,148 Points

Yes it should work fine. I agree with Tommaso, so other rule must be overriding it.