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!

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

HTML HTML Forms Organizing Forms Fieldsets and Legends

Dennis de Vries
Dennis de Vries
9,440 Points

Styling form elements more difficult? (From the extra credits part)

Hi everyone!

I dove into the extra credits part of this course. It says: "Styling form elements can be slightly more difficult than other types of HTML elements. "

Thing is, though, when I look at the CSS, it all looks pretty straightforward, even to a n00b like me. (who only has CSS-basics)

I couldn't quite figure out what makes styling form elements any different than styling other html-elements in CSS. Any thoughts on that?


1 Answer

Hi Dennis,

I may well just be the slightly more complex selectors you can use to style different form states like, active, focus and so on. You are moving from some thing like a class for your for text input field to what might be a disabled button or focused email input for example.

I would pretty much say it is all based around selectors though, nothing is really going to catch you out :)

Examples would be:

input[type="text"][disabled]:hover {
  background: darkgrey;  

there are many combos of this type of selector in relation to forms to so that could be it to :)

Hope this helps Craig