/    Sign up×
Community /Pin to ProfileBookmark

I have a table and set the cell width in pixels. when i enter text is stretches the width. how can i fix the width of the cell so it will take text and keep same width?

to post a comment
HTML

6 Comments(s)

Copy linkTweet thisAlerts:
@jdaviaMar 20.2003 — [i]Originally posted by Richcoleuk [/i]

[B]I have a table and set the cell width in pixels. when i enter text is stretches the width. how can i fix the width of the cell so it will take text and keep same width? [/B][/QUOTE]

Add a width to the cells.

<TABLE height="100%" cellSpacing="0" cellPadding="0" width="100%" border="1">

<TR align="left" valign="top">

<TD width="50%" >This is some text This is some text This is some text This is some text This is some text This is some text</TD>

<TD width="50%" >This is some text</TD>

</TR>

</TABLE>
Copy linkTweet thisAlerts:
@RichcoleukauthorMar 20.2003 — also if i want to set the font for the entire page do i just put

<font size="8" face="tahoma"> at the beginning?
Copy linkTweet thisAlerts:
@jdaviaMar 21.2003 — [i]Originally posted by Richcoleuk [/i]

[B]also if i want to set the font for the entire page do i just put



<font size="8" face="tahoma"> at the beginning? [/B]
[/QUOTE]


Like this: But size "8" is is pretty big text. Don't forget the closing tag.

<font size="8" face="tahoma">[b]Yout text here[/b]</font>
Copy linkTweet thisAlerts:
@BeauchampMar 21.2003 — hi there

Setting the font for the entire page:

You could use a standard font tag right at the beginning, then close it right at the end or you could use the BASEFONT tag, e.g.

<BASEFONT face="Verdana,Arial" size="2">

This tag can go in the HEAD or at the beginning of a document right after the BODY tag.


Table cell resizing - you have set a pixel width for a cell but the cell resizes when you enter text:

If you are using a web editor e.g. Dreamweaver check that the 'No Wrap' box in unticked for that cell.

Also, if you are specifying a narrow cell width check for long words in the text. A long word will force the cell width. You can reduce the font size, set a wider cell width in pixels or split the word with a hyphen if possible.


Hope that helps
Copy linkTweet thisAlerts:
@nkaisareMar 21.2003 — Be advised that this is pre-1997 way of doing things. We are in 2003 now.

Avoid using tables for page layouts.

Avoid using <font> for font definitions.

Avoid using <basefont>. Especially true because if you do not have a proper doctype, basefont may be neglected by some browsers.

Use stylesheets instead.

Tutorial: http://www.w3schools.com/css/default.asp

CSS Layout: http://www.glish.com/css/

http://www.thenoodleincident.com/tutorials/box_lesson/boxes.html
Copy linkTweet thisAlerts:
@NedalsMar 21.2003 — ....set the cell width in pixels. when i enter text is stretches the width.[/quote]If you set the cell widths in, say, row 1 and the put text in row 4, the text will cause the cell to expand. To solve this, you need to specify the cell width for the specific <td> cell that contains the text.
...set the font for the entire page...[/quote]
You should really use CSS for that.

body { font:8pt Tahoma,sans-serif }

td { font:8pt Tahoma,sans-serif }

b { font-weight:bold }

I assume you mean 8pt not size="8" (HTML max = '7'). Size '7' is probably 36pt. The additional CSS items are there for Netscape (if you care)
×

Success!

Help @Richcoleuk 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.28,
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,
)...