/    Sign up×
Community /Pin to ProfileBookmark

Table cell max width

How can I set the maximum width of a table cell. The field width will vary depending on what characters are display. For example, W’s will expand the field wider than I and make the fields to the right go to double lines. Try width=”180″ but it did not work.
Any help or advice would be greatly appreciated.

to post a comment
HTML

5 Comments(s)

Copy linkTweet thisAlerts:
@CharlesMay 08.2003 — [font=georgia]There's nothing that you can do about that. Tables are for organizing data and not intended for controlling layout. You are supposed to use CSS for that.[/font]
Copy linkTweet thisAlerts:
@Robert_WellockMay 08.2003 — Basically what Charles was saying the table cells can be set to a specific pixel width in HTML although to try and imposes a 'maximum size' you would use CSS similar to the following:

<style type=”text/css”>

<!--

td{max-width: 180px;}

-->

</style>

Also as he rightly pointed out tables are actually designed for displaying and [i]accommodating[/i] tabular data rather than positioning text and graphics, etc.
Copy linkTweet thisAlerts:
@mikey1000authorMay 14.2003 — The command max-width is not supported by any browsers.

This according to my tests (if I am writing the code correctly) and Osborne's The Complete Reference HTML Third Edition.

Any other suggestions/ideas?

Thank you in advance
Copy linkTweet thisAlerts:
@pyroMay 14.2003 — Put your text inside a <div> and set the style up like this:

<div style="width: 180px; overflow:hidden;">

That will, of course, hide any content that goes beyond the 180px...
Copy linkTweet thisAlerts:
@mikey1000authorMay 14.2003 — Tried that didn't work. Where would I put this <div> tag.

I tried in the asp doc only and not in the style sheet.

The original line reads is the asp doc:

response.write("<td id=""twelve"">" & objrs("field12") & "&nbsp;</td>")

The related line reads in the css doc:

#twelve {width: 180;

color: black;

font-family: Arial:

text-align: left;

font: 10pt;

font-weight: normal;

font-style: normal;

background-color: white;}

I tried:

response.write("<div style=""width: 180px; overflow:hidden;""><td id=""twelve"">" & objrs("field12") & "&nbsp;</td></div>")
×

Success!

Help @mikey1000 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.14,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...