css - Headings should only be defined once -
just ran decent amount of css through csslint, check errors. 80% of warnings defining same header element more once. wondering best way clean these kind of styles be...
h4 { color: red; } .archive h4 { color: green; }
keeping in mind i'm using h1 - h6 styles elsewhere in design.
would better use classes , inherit styles mix-ins (i'm using stylus)?
h4 { color: red; } .archive-header { color: green; }
while i'm @ it, why csslint warn against this? there performance hits?
- to around it, sure... you're solution should work fine.
- css lint warns against because shouldn't style same headers differently. here's little excerpt article talking more subject:
when styling headings (or anything) want 3 big goals met:
- dry – not repeat yourself. want set headings once , never (ok, rarely!) repeat font styles or selectors. make our site easier maintain.
- predictable – heading should same no matter on page placed. make creating new pages , content easier.
- keep specificity low , selectors simple possible. performance , keep site growing more , more tangled on time.
- no performance hits. if anything, might better use class name instead of tag. solution proposed textbook recommendation of how make website faster google.
Comments
Post a Comment