earl_dc10 Posted March 18, 2006 Share Posted March 18, 2006 hey, Im wondering if I can have more than one class for an element, I have links on my page which I want to have all the same attributes, but each one have a unique setting so to speak. simplified example:[code]td.1{ background-color: black;}td.2{ border-style: solid;}// and then<td class="1" class="2"></td>[/code] Link to comment https://forums.phpfreaks.com/topic/5255-multiple-classes/ Share on other sites More sharing options...
Javizy Posted March 18, 2006 Share Posted March 18, 2006 I've never come across a situation where I've needed to do something like that, and as far as I know it's not possible. I would do it like this...[code]table.parent {}table.parent td { /* set defaults */}table.parent td.1 { /* set specific 1 */}table.parent td.2 { /* set specific 2 */}[/code] Link to comment https://forums.phpfreaks.com/topic/5255-multiple-classes/#findComment-18663 Share on other sites More sharing options...
earl_dc10 Posted March 18, 2006 Author Share Posted March 18, 2006 ok, thanks! Link to comment https://forums.phpfreaks.com/topic/5255-multiple-classes/#findComment-18668 Share on other sites More sharing options...
theverychap Posted March 19, 2006 Share Posted March 19, 2006 totally possible, just use:[code]<td class="1 2">...[/code]and styles from both classes will be applied...it does get more complicated depending on specificity and styles declared but thats enough for you to be getting on with ;~) Link to comment https://forums.phpfreaks.com/topic/5255-multiple-classes/#findComment-18684 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.