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
Dylan Carter
4,780 Pointswhich would be better way to have my css file laid out?
header {
width: 100%;
margin: auto;
padding: 0 0 15px;
background: -webkit-gradient(linear, 0 50%, 0 100%, from(white), color-stop(0.5, yellow), to(red));
background: -webkit-linear-gradient(-180deg, #4E7A2F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
background: -moz-linear-gradient(-180deg, #4E7A2F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
background: -o-linear-gradient(-180deg, #4E72F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
background: -ms-linear-gradient(-180deg, #4E7A2F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
background: linear-gradient(to top, #4E7A2F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
box-shadow: 0 20px 15px #4E7A2F;
}
OR....
/*layout*/
header {
width: 100%;
margin: auto;
padding: 0 0 15px;
}
/*style*/
color:#f8f8FF;
background: -webkit-gradient(linear, 0 50%, 0 100%, from(white), color-stop(0.5, yellow), to(red));
background: -webkit-linear-gradient(-180deg, #4E7A2F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
background: -moz-linear-gradient(-180deg, #4E7A2F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
background: -o-linear-gradient(-180deg, #4E72F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
background: -ms-linear-gradient(-180deg, #4E7A2F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
background: linear-gradient(to top, #4E7A2F, #51822F, #52852E, #538A2D 60%, #5A9630, #5DA32C, #5EB025);
box-shadow: 0 20px 15px #4E7A2F;
now, the first one is more messy when it has it all at once, while the second is more organized into css objective sections, BUT, the top code only has to designate header once so that seems like it would be more efficient loading wise.
so like when you do these two concepts for whole big websites with a lot of css, would it be better to repeat yourself a little to have it laid out clearer.?
1 Answer
anil rahman
7,786 PointsIn the css course Gill happens to go with the second option and repeats him self to organise his code better for different sections/purposes.
Such as
colour navigation links ...