Hi All, I have a site with lots of <tables> and redoing them would be just a waste of time. I want to override the "height" and "width" of a <td> tag using CSS or any other method as long as the method changes the attributes mentioned above globally throughout the website. Is it possible or not? And if its possible how can we do it. I am on a tight schedule fellow members. Any help would be highly appreciated. Thanks in advance. Cheers
Hi K, Trying to grasp what you mean here - have you a link? If I got your idea right, then the easiest way to do it is to leave your site as it is with the tables and create a new div. That will override the TD as it will be on top of it. However, it won't adhere to the it's parent values so you will have to place them manually.
I have HTML code as follows: <div id="someid"> <table> <tr><td width="50" height="50">Some Data</td></tr> </table> </div> HTML: Now the width and height needs to be modified to 40 and 40 respectively. I was trying using the following CSS: #someid table td { width: 40px; height: 40px; display: block; } Code (markup): But the TD width and height doesn't change. Even with "!important" modifier is doesn't work. I would manually change the heights but my site has 100+ such tables.
Right, well the easiest thing to do is this. Declare the body in the stylesheet to be 100%. After that you can either individually style each td or make a class for them. Either way, do not make a width for the table itself as it will take preference over the td. You can make a width for a table but you need to then make the <td> a % of that width. The code is an extremely bare essential for what you need. Code together a class specific for your needs and then just include it in every <td class="sameforalltds"> Remember, you can put any width on a <td> and don't close the <tr> so you will have two <td>'s beside eachother. If you have a table of say 200px and the first <td width="70%"> Then the second will start at 70. Regarding the height of the <td> same applies. Use old-school methods like bgcolor= to get a better idea of how your table will appear. Hope that helps <body width="100%"> <table> <tr> <td valign="top" style="width:100px;" bgcolor="yellow"> Some Data </td> </tr> </table> HTML:
Hi le007, Thanks for your answer, but I have more that 100 such table where it needs to be changed and it resides in Wordpress Posts. So I guess I'll have to remove all of <td width="<some_value>" height="<some_value>"> individually and correct. Thanks for your interest though
You could just put those attributes in a class and then add the class to the <TD>'s. I just thought you may have different widths for each <TD> etc.