Michdd Posted October 26, 2008 Share Posted October 26, 2008 In CSS how do a set a max-width for my <tr> (table) Quote Link to comment Share on other sites More sharing options...
kevin777 Posted October 26, 2008 Share Posted October 26, 2008 I'm not sure if this works, but can you just add a class to the TD and then use the regular css 'max-width=xx' i.e. td.classname{max-width:500px;} If this wont work can you add a div inside the TD and give the div a max width? like this: css: table tr div.stylename{max-width:500px;} html: <table border="1"> <tr> <div class="stylename"> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </div> </tr> <tr> <div class="stylename"> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </div> </tr> </table> Maybe another way could be to use php, as in set the width of the TD to a php variable which is connect to a max width setting ? Goodluck Quote Link to comment Share on other sites More sharing options...
dropfaith Posted October 26, 2008 Share Posted October 26, 2008 Wont validate as theres elements other then td or th in a tr tag <table border="1"> <tr> <div class="stylename"> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </div> </tr> <tr> <div class="stylename"> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </div> </tr> </table> Will Validate <table> <tr> <td> <div class="stylename"> <table> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> </tr> </table> </div> </tr> </table> 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.