galvin Posted January 11, 2009 Share Posted January 11, 2009 If throughout my code I have a bunch of classes like name1, name2, name3, etc. etc through name50, is there a way to write the CSS just ONCE, so that it styles the same thing for all of those different classes. Essentially, I'd want something like the following where X could be any number... .nameX { } ...rather than have to do... .name1 { } .name2 { } .name3 { } and so on. Quote Link to comment Share on other sites More sharing options...
Mchl Posted January 11, 2009 Share Posted January 11, 2009 If you want all those to have same style, why not style them with one class? Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted January 11, 2009 Share Posted January 11, 2009 You can use multiple classes for one div or element. Separate classes by a space. Unfortunately, CSS has poor variable properties. You can't mix and match, or fuse properties into other classes. Quote Link to comment Share on other sites More sharing options...
htmlstig Posted January 12, 2009 Share Posted January 12, 2009 you need to seporate the classes with a comma not a space. If you seporate it with a space its telling it to style a class within a class. so for what you want you could put .name1, .name2, .name3 { css: code here; } Or why not make it even simpler like Mchl said and give them all the same class Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.