wordpress - How to recognise when it is appropriate to code CSS -
i working on custom css file within wordpress theme installation.
within css, there times when need identify '.example', other times when must displayed '#example' , other times when fine maintain 'example'.
could please clarify rules , how can distinguish , decide myself in future 1 utilize in each instance?
this might have div ids , classes.
there no 100% rule generally:
an id
must unique, hence styles applied id usable 1 element on page. hence makes more sense style class rather id because mjority of time going want reuse styles. additionally using id makes harder override style later because id's hijack specificity.
i take 1 step farther in nil should ever styled id rather styled class. 1 exception create page-level scoping based on id of body
tag. class useful.
id recommend reading on oocss (note: dont utilize of files used illustrate examples - im solely referencing faq)
css wordpress class html rules
No comments:
Post a Comment