Solved

How to fix the width of a td tag.

Posted on 2002-06-18
16
505 Views
Last Modified: 2006-11-17
Hello,

I try to fix the width of columns :
<td fixed width = 180>test</td>

But the result is that the td tag wraps the text and the td is not wider than the text.

How can I do ?

Thank you.


0
Comment
Question by:laurent_diep
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 3
  • +3
16 Comments
 

Expert Comment

by:jusnokso
ID: 7087340
Solution which I usually use are empty transparent 1x1 px gif's. Just create one and put the <img scr="1x1.gif" height="1" width="180" alt=""><br> to your code, it stretches the <td> and keeps the correct size in no mather what.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7087798
jusnosko,

Welcome to Experts-Exchange.  Please read the guidelines for comments and answers.  We submit with comments only unless what we are providing is definitive and complete.  It may turn out that your comment provides a solution, but by posting it as an answer you have removed the question from the active list which will limit discussion.  

Most members of the community would consider your action disrespectful of the user.  Please refrain from doing this in the future.

laurent_diep,

Cell sizing problems can have a number of causes and solutions, and if multiple browsers need to be support it becomes even more difficult.  If the proposed solution does not completely solve the problem, you should reject that, and give us a little more information, about the content of the cell and the browsers you need to support.  posting more of the code or a link to the page would also help.

Cd&
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 100 total points
ID: 7087824
If what you are trying to do is push out the cell size, try doing it this way:

<td width="180" nowrap>test</td>

Cd&
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:jusnokso
ID: 7087886
sorry for that, it was my first answer.. I'll know next time :)
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7088268
No problem happens all the time.  If you are just starting out on the site, you may find some of the threads in this topic area helpful:

http://www.experts-exchange.com/new_users/

Cd&
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7090360
jusnokso

Don't worry, I rejected it for now. Let's see, maybe you still get the points.

** Mindphaser - Community Support Moderator **

0
 

Expert Comment

by:endamcg
ID: 7091986
Hi

jusnokso's comment is quite a common way but note that it also can depend on yout table properties.

If your table is width=100% for example you should try to match your cells to that.
I almost always work with fixed with tables and cells.

Try something like
<table width="650" summary="">
<tr>
 <td width="180"> content </td>
</tr>
<tr>
 <td width="350"> content </td>
</tr>
<tr>
 <td width="120"> content </td>
</tr>

Or you could define all width's using percentages and add felxibility to your table.

Personally I think its best to avoid always using transparent gifs to define your table props, it has caused my problems in the past so I never do it anymore.


0
 

Expert Comment

by:jusnokso
ID: 7092024
"Personally I think its best to avoid always using transparent gifs to define your table props, it has
caused my problems in the past so I never do it anymore."

What kind of problems are u talking 'bout? I've been working as a front-end coder for four years now, and haven't had any problems with those transparent images, contrary.

Defining table and td widths isn't allways enough. Especially NN4.x will stretch your tables according to the td's content, not by the width atribute.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7092382
laurent_diep,

Unless you provide some feed back it is not like you are going to get much help.  We need mor infromation about the setup of thei table and it you don't give it to us, then it is just a guessing game.  

If you want a solution, then participate.

Cd&

0
 

Expert Comment

by:mv_suresh
ID: 7105950
<td style="width=180">

try this, hope this should work for you
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7107138
mv_suresh,

Did you not read the comments in this thread before you posted.  style="width:180" in no different than what has already been posted.  You have been on the site long enough to know better then to use the answer button for such a comment.  I will refer this to the moderators.

I guess part of the problem here is the failure of laurent_diep to give any kind of meaningful response.

Cd&
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7107228
mv_suresh

I rejected your comment per request. COBOLdinosaur gave you a good reason for this rejection. You can always reread our "How to" at http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp

** Mindphaser - Community Support Moderator **
0
 

Expert Comment

by:mv_suresh
ID: 7107563
I am sorry, I never read all the answers.

0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7107778
mv_suresh

I think it is part of community sense that you 'listen' to what other people 'say' before you give an answer. These written discussions work like a live discussion. If you don't know what people talk about, it would be better not to comment at all ... That is one big difference here versus newsgroups where people comment without any rules ...

0
 

Author Comment

by:laurent_diep
ID: 7115911
mv_suresh, endamcg, jusnokso : Thank you to answer.

COBOLdinosaur : I tried your "nowrap" option succesfully so the points come to you.

Thanks again.

Laurent_Diep.

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7116041
Glad we could help.  Thanks for the A. :^)

Cd&
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question