- IDs are best suited for naming parts of your layout so should not give same name for ID and class
- ID allows alphanumeric and special characters
- but avoid using of # : . * ! symbols
- not allowed spaces
- not started with numbers or a hyphen followed by a digit
- case sensitive
- using ID selectors is faster than using class selectors
- use hyphen "-" (underscore "_" can also use but not good for seo) for long CSS class or Id rule names
- If a rule has an ID selector as its key selector, don’t add the tag name to the rule. Since IDs are unique, adding a tag name would slow down the matching process needlessly.
- In HTML5, the id attribute can be used on any HTML element and In HTML 4.01, the id attribute cannot be used with:
, , , , ,
Comments
Only these kind of rules available in CSS???But I knew only few rules in CSS when i was studied CSS and HTML.Now only i learned what are the other rules available in CSS.Thank you for your updates.
ReplyDeleteWebsite Creation Bangalore