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 trialG H Mahimaanvita
16,234 PointsWhy are both the input:focus and textarea:focus are targeted in css?
Hello! Please help me:
I do not understand why both the input and textarea were targeted in the stylesheet :
input:focus,
textrea:focus
{
border-color: pink;
}
The border still appeared when I did not target the textarea
input:focus
{
border-color: pink;
}
Also, the border didn't appear when I targeted just the textarea and not the input field
textrea:focus
{
border-color: pink;
}
1 Answer
Steven Parker
231,198 PointsAt this point in the video, there are no "textarea" elements in the HTML. All of the boxes are "input" elements, and that explains what you observed. It's possible that the page design will be extended later by adding one ore more "textarea" elements, and that selector will become effective at that point. Otherwise, you're right, that selector isn't needed.
Also, I noticed that in both the examples above, you wrote "textrea" instead of "textarea". That would also prevent it from working (if there were any elements of that type).
G H Mahimaanvita
16,234 PointsG H Mahimaanvita
16,234 PointsOh..I see now, Thank you