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 trialdjsands
6,286 PointsPractice CSS Selectors .. . my version ... ?? feedback??
/* Change the color of all list items inside an unordered list */
ul li { color: black; }
same
/* Remove the text decoration from navigation links, and change their color when hovered */
--mine-- nav ul li a { text-decoration: none; }
--answer-- nav a { text-decoration: none; }
or
nav a:link { text-decoration: none; }
--
/you have to put a:link, before the hover thingy as a:link=unvisited/ nav ul li a:link, a:hover { color: yellow; }
--answer-- nav a:hover { text-decoration: skyblue; } /* Create visited and hover styles for all links inside 'main' */
main a:visited { color: red; }
main a:hover { color: blue; }
/* Change the background color of the submit button when active. Check teacher's notes for resources on this part of the challenge. */
.button:hover { background-color:orange; }
--answer-- input[type="submit"]:active { background: firebrick; }
/* Give the text field a blue border upon focus. Check teacher's notes for resources on this part of the challenge. */
input[type=text]:focus { border: blue; }
--answer -- input[type=text]:focus { border-color: 1px solid #4683af; } /* Give the 'span' tag in the footer a meaningful class name and reduce its font size */
.footer-info { font-size: 10px; }
/* Give the 'img' tag in the header an ID and set its width to 190px */
logo {
width:190px; }
/* Target all heading tags on the page and set their font family to 'Bree Serif', serif */
.headings { font-family:"Bree Serif', serif"; }
--answer-- h1, h2, h3 { font-family:"Bree Serif", serif; }
2 Answers
Alan Brown
20,524 PointsHi Diane, This looks like a pretty good effort to me. Where your answers differ is usually regarding specificity. This is something that you will hone over time.
nav ul li a
vs nav a
--> too specific. All instances of your links will have the ul
and li
between, so they are redundant.
Adding .button
and .heading
--> while this works they are not needed. Just style the types directly. In the case of the submit button the attribute selector lets you target just the submit version of input avoiding any other fields or even buttons.
Personally I think that just border: blue;
is fine for styling provided you are happy with the initial values for the shorthand values you have omitted. Two points to note however.
- It may be clearer to state all three values in the border shorthand when working with large sites to avoid confusion.
- Eventually you’ll probably stick with hex colors everywhere. While the named colors are handy they do not cover all colors. It is good practice to use the same ‘house style’ everywhere, so all hex, or all rgb ends up being standard. Hi like hex ;-)
djsands
6,286 PointsExcellent, Thanks for that feedback, yes specificity is something I struggle with, too much vs too little ...
Steven Parker
231,261 PointsSteven Parker
231,261 PointsWhen posting code, be sure to use Markdown formatting to preserve the appearance.