Now i have a stylesheet called animations, and in that i have the following code:
.arrowInfiniteAnim { -webkit-animation-duration: .5s; -o-animation-duration: .5s; animation-duration: .5s; -webkit-animation-direction: alternate; -o-animation-direction: alternate; animation-direction: alternate; -webkit-animation-iteration-count: infinite; -o-animation-iteration-count: infinite; animation-iteration-count: infinite; -webkit-animation-name: arrowInfiniteAnim; animation-name: arrowInfiniteAnim; }
Now suppose when i use the above class in practice i would like the size of the element to be 3em, So in my main stylesheet i add the following code:
.arrowInfiniteAnim { font-size : 3em; }
So my question is , is it correct to define rules for the same class in multiple style sheets ?
Thank you.
Hi gautamz07, Yes it is
Hi gautamz07,
Yes it is correct and good practice as long as you have clearly defined the purpose of each stylesheet.
For example:
layout.css
animation.css
content.css
...
Tony yes thanks
One of the reason i have a separate stylesheet for animations is , they tend to run into a few hundreds of lines. I just wanted to keep the animations separate. Thanks for confirming .
Have a nice day
Now, for a different opinion
My experience comes from primarily the maintenance and debugging point of view. If you realize that those two factors (in a non-trivial site) cost one and one-half to two times the original development costs per annum, you'll see that making everything human readable, from organization to formatting is critical to keeping costs down.
I find that writing your stylesheets, grouping contextually does save that time and effort. A positive side effect is that you will be less likely to unintentionally write conflicting style rules; not to mention that order of loading the stylesheets becomes an issue in the cascade order.
Contextual stylesheets do require that you pre-plan your rulesets; you can't just throw them in any old place, as can easily happen with multiple files.
cheers,
gary
Contextual stylesheets
Contextual stylesheets ... yeah thats the right word , so you think its a good thing or a bad thing ? ... i think its a great idea and helps me keep things organized.