Jump to content

Child class overwrite parent class?


5kyy8lu3

Recommended Posts

Hi.  I set my table to a custom class. Like so .ColTitles {}

 

The font color for everything in the table is set to blue according to this class I set.

 

When I'm using a specific column to sort my table with, I use php to add a class="sortedby" to the anchor tab around that column name.  The column name is inside a <td> which is inside that table.  This changes the color of that column name so I can tell visually which column I'm sorting with since it'll be a different color.

 

I tried it and it doesn't work.  I checked the source and it's definitely putting class="sortedby" in the anchor tag and i check the style.css and i definitely uploaded the new on that includes that class.

 

So... this leads me to believe I can't override the main table's class and it just inherits those font properties?

 

I'm not sure what's going on, I know I can make this work with <font color=""> but I'd like to stick with css. Thanks ahead of time.

 

Oh and I'm sure people will ask why I'm using table, i'm using it for tabular data, it's for my IP log table.  ;)

 

UPDATE: ok i decided to just switch to using php to inject an inline style to the anchor tag for now, it worked, but I'd still like an answer to my original question, thanks =)

 

Still not sure how this works but my previous method didn't lol.

 

This didn't work:

 

.sortedby a{
color: #f7f8b9;
}

<?php
echo '<a class="sortedby">BlahBlahBlah</a>
?>

 

but this did:

 

<a style="color: #f7f8b9;">BlahBlahBlah</a>

 

weird

Link to comment
https://forums.phpfreaks.com/topic/172381-child-class-overwrite-parent-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.