Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Fixed cell width, HTML tables?
How can I make it so that when a browser is resized by a user, the table cells dont resize with it. I want to always make each cell fixed at 200px wide?
I've tried all your methods and none of them work..... the table still resizes the cells when you change teh size of the browser
6 Answers
- 1 decade agoFavorite Answer
put this in the tag for each cell:
width="200"
I think that should make them stay 200 px wide.
- 1 decade ago
The use of <td width="200"> is not considered to be clean code anymore with the introduction of css though it has not officially been deprecated.
The answer above dealing with CSS is incorrect as it would make the table 200 pixels wide and not the cells.
The proper way to do this would be to use css, but make the cells themselves 200px wide whcih could be done two ways:
---1. for use in seperate stylesheet---
table.main td { width:200px; } /*in your stylesheet*/
<!--then in your html-->
<table class="main">
<tr>
<td>1</td>
<td>2</td>
</tr>
</table>
---2. for use inline---
<table>
<tr>
<td style="width:200px;">1</td>
<td style="width:200px;">2</td>
</tr>
</table>
Also, since you have rather wide cells, your table will resize due to a browser window being narrower - a way around this is to include a transparent gif that is simpy 1 pixel tall at the beginning of each cell - it is a little hacky, but until all browsers honor the css 'min-width' property, it is the only surefire way around this.
- 1 decade ago
You need to "fix" the cell width using either the "width" attribute (works and is still good clean code), or use CSS with divs. Remember to always have some content (even if its a non-breaking space character in the cell). I had a very picky client one and finally resorted to using transparent 1X1 pixel gif. That was not clean code (unfortunately), but will work on all browsers on all platforms and monitors. - http://www.webdevelopersnotes.com/tutorials/adhtml...
- 1 decade ago
Inside the CSS tag you're creating (you are using CSS right? I hope so, it's the standard! :) ) you want to perform the following properties:
NOTE: I'm just going to supply it with a table class name of "main" for this demo
table.main
{
width: 200px;
}
The other demos with the: width="200" tag inside of it that I see you need to be careful with, as that will not work with newer browsers that adhere to the current W3C standard for web-development. After putting in that class, in your table you want to perform the following:
<table class="main">
<tr>
<td>[All your content here]</td>
</tr>
</table>
Viola! That easy. Hope that helps you out.
- How do you think about the answers? You can sign in to vote the answer.
- Meg WLv 51 decade ago
Do it the stylesheet way. The "width" will work, but it's the old way.
Source(s): Even tho stylesheets could use some style themselves. Ugh. - 1 decade ago
width="200"
Source(s): <table> <tr> <td width="200">1</td> <td width="200">2</td> </tr> </table>