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 The Selectors Solution

CSS To Target Submit Button

So the original question did not have a definitive response and I was hoping to get clarification. I did a similar answer to the test question about the submit button, not having coded button CSS on my own before. My code:

.subscribe input[type="submit"]:active { background: brown }

I get the same result as the "correct" answer but I am wondering if this is just a preference or if there is a best practice?

Also confused by why "submit" in video was put in single quotes and "text" was placed in double quotes. Any particular reason? When I did a quick search online I found an example using no quotes on the word submit. All options produce the same result. Is this just another best practice and which one is correct?

Thank you for your help.

1 Answer

Samuel Ferree
Samuel Ferree
31,722 Points

In my opinion, the point of this exercise is to expose you to some of the more specific css selectors, for the purposes of selecting a submit button, this is definitely not common, and almost surely not best practice.

With something as unique (to a single page) or as consistent (across an entire application) as a form submit button, an id or class selector seems more appropriate.

Sometimes however, you may not have control over the html, and these advanced selectors may be your only option. So it's good to know them.