@BigMoosieOct 14.2009 — #CSS stands for "Cascading Style Sheets". The word "cascading" is particularly relevant to your question, it stands for the order of preference with regard to styling.
In your case, if you have class and style attributes and they do not conflict (eg. one of them defines color and the other defines size), then both of them will apply. If there is a conflict then the 'style' attribute has precedence over the specified class.
Basically the order of precedence is:
1. "style"
2. "class"
3. "id"
4. element (defined in a css file)
There are also more complicated rules for element selectors like "div .myclass:first-child" but it sounds like that is beyond the scope of your question.
@cofactorauthorOct 14.2009 — #CSS stands for "Cascading Style Sheets". The word "cascading" is particularly relevant to your question, it stands for the order of preference with regard to styling.
In your case, if you have class and style attributes and they do not conflict (eg. one of them defines color and the other defines size), then both of them will apply. If there is a conflict then the 'style' attribute has precedence over the specified class.
Basically the order of precedence is:
1. "style"
2. "class"
3. "id"
4. element (defined in a css file)
There are also more complicated rules for element selectors like "div .myclass:first-child" but it sounds like that is beyond the scope of your question.[/QUOTE]
glad to know this concept.
I though they will follow the placement order ! like , for example if there is class="abc" style="abc" for the same color say ......I assumed as class is at the beginning so class will be loaded and style be ignored.
But from your comment , it feels to me that they have to follow as per the order you mentioned ALWAYS.
why its like that way ? any specific reasons ? or its just the rules i have to memorize ? ....i am tired of rules ...rules ...rules
@BigMoosieOct 14.2009 — #The order of HTML attributes has no ramifications, ever.
Note: I can see a potential pitfall in interperating my previous post, note that the conflict resolution is re-evaluated for ever single css attribute, i.e. if there is a conflict with 'color' then it is resolved, if there is a conflict with 'border' it is resolved following the rules again, etc.
These rules may sound just like boring old rules, but they are extremely logical, and become more and more efficient and beneficial the larger and more sophisticated your project becomes.