Solved

How to fix the width of a td tag.

Posted on 2002-06-18
16
497 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
  • 6
  • 3
  • 3
  • +3
16 Comments
 

Expert Comment

by:jusnokso
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Expert Comment

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

Expert Comment

by:COBOLdinosaur
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
"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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
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
Comment Utility
<td style="width=180">

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

Expert Comment

by:COBOLdinosaur
Comment Utility
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
Comment Utility
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
Comment Utility
I am sorry, I never read all the answers.

0
 
LVL 6

Expert Comment

by:Mindphaser
Comment Utility
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
Comment Utility
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
Comment Utility
Glad we could help.  Thanks for the A. :^)

Cd&
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now