By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,607 Members | 1,931 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,607 IT Pros & Developers. It's quick & easy.

how to get css code to recognize table width values

P: 2
this code all works except for the width values which are seemingly not recognized:

Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <style type="text/css">
  3. table, td, 
  4. table
  5. {
  6. width:800;height:25;
  7. }
  8. table
  9. {
  10. position: absolute; right: 100px; top: 80px;
  11. }
  12. table
  13. {
  14.  border-collapse:collapse; 
  15. }
  16. td
  17. {
  18.   border-spacing:0px;
  19. }
  20.  
  21. td
  22. {
  23.  border-collapse:collapse; 
  24. }
  25. td
  26. {
  27.   border-bottom-style:solid;
  28.   border-bottom-width:1px;
  29.   border-color:black;
  30. }
  31. td
  32. {
  33. background-color:grey;
  34. color:red;
  35. }
  36. td
  37. {
  38. text-align:center;
  39. }
  40.  
  41. </style>
  42. </head>
  43. <body>
  44. <table>
  45. <tr>
  46. <td width='20'></td>
  47. <td width='400'>First Name:</td>
  48. <td width='340'>{$info['firstname']}</td>
  49. <td width='40'><a href='changefirstname.php'>edit</a></td>
  50. </tr>
  51. <tr>
  52. <td><td>Last Name:</td>
  53. <td>{$info['lastname']}</td>
  54. <td><a href='changelastname.php'>edit</td>
  55. </tr>
  56. <tr>
  57. <td></td>
  58. <td>email:</td>
  59. <td>{$info['email']}</td>
  60. <td><a href='changeemail.php'>edit</td>
  61. </tr>
  62. <tr>
  63. <td><td>password:</td>
  64. <td>********</td>
  65. <td><a href='changepassword.php'>edit</td>
  66. </tr>
  67. </table>
  68. </body>
  69. </html>
Jul 16 '12 #1
Share this Question
Share on Google+
6 Replies


Rabbit
Expert Mod 10K+
P: 12,430
Please use code tags when posting code.

The table looks fine to me. You have to explain what you mean by not working because it seems to be working for me. You also need to tell us what browswer you're testing on. Different browsers produce different results.
Jul 16 '12 #2

P: 2
Sorry I was not specific, where I have put <td width....>it has not recognized so all table cells are at default width ie a equal proprtion of the total table width. (google crome)
Jul 16 '12 #3

Exequiel
100+
P: 288
every time you put width value to your table code in css, the width of your table remain in HTML... for example you put width:800;height:25;. the out put to your html for table width will be 800 for width and 25 for height, so when you try to put width to your td in html tag it will remain your table width, the only changes is on your td. and I observed, your height for your table is only 25px. So when you try to make another table, it cannot be shown because of the set height to your css for table...
Jul 17 '12 #4

Rabbit
Expert Mod 10K+
P: 12,430
You'll have to apply it in a style, and you have to do it for every cell.
Jul 17 '12 #5

Exequiel
100+
P: 288
Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. table { margin: 1em; border-collapse: collapse; box-shadow: 5px 5px 8px #999; border-radius: 15px;
  3. }
  4. td{ padding: .3em; border: 1px #FFF solid; box-shadow: 2px 2px 2px #CCC; border-radius: 2px;}
  5. thead { background: #00468C; }/*you can use this one if you try to put <th> tag to your table*/
  6. tbody { background: #CCC; }
  7. table tr:hover { background: #AAFFBF; }
  8.  
  9. </style>
Try this code for the table... :)
Jul 18 '12 #6

P: 75
if you want to adjust you td width you need to adjust your table width,
Jul 18 '12 #7

Post your reply

Sign in to post your reply or Sign up for a free account.