- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
selector
September 8, 2015
CSS elector is the name of each element of your site. With help of selectors you can add CSS rules and style only those elements you want to.
There are plenty of ways to select an element of your site to style it, but the more specific selector is, the better. For example, it’s bad for your site to use generic selectors like .span12
, because styles applied for such selector will appear in many places on the site, everywhere where such class is used.
Most generic selector is by element. e.g. p or div. CSS rule with them looks like this:
div { color:#fff; }
A little more specific selector is by class, for example .yourcustomclass or .span12 and the rule will look like this:
.yourcustomclass { color:#fff; }
The most specific selector is by elements ID, because IDs are unique, for example #myid. And the rule will look as follows:
#myid { color:#fff; }
Each selector type is used for different goals, depending on whether you want to effect one element or numerous with your CSS rule.
Now you know what selector is, thank you for your time.