/    Sign up×
Community /Pin to ProfileBookmark

td widths when table width is 100%

I need clarification on how the table cell widths should be calculated when you are using percentages.

Until now I have always calculated my cell widths so that their combined value equals the value of the table width.

ie.

<table width = “80%”><tr>
<td width = “50%”>
<td width =”30%”>
<tr></table>

However, recently I was challenged on this and it was suggested that the combined value of the table cell widths should always equal 100% and it is only the table width percentage that needs to be changed.

<table width=”80%”>
<td width = “63%”>
<td width =”37%”>
<tr></table>

Although I know this method can work, I’m not sure if its “good” code and I thought what I was doing was correct.
Please could someone clarify.

Any help appreciated.

Regards,

JsLady

to post a comment
HTML

2 Comments(s)

Copy linkTweet thisAlerts:
@spufiDec 02.2003 — The second way is correct because it is using the percentage of what tag it is in. Just like the <table> tag is going off of the <body> tag's size, the <td> tag is using a percentage of what the <table> tag is. If the <table> tag is 80% wide, and the <td> tag is 50% wide, the <td> tag is actually 40% of the the <body> tag.
Copy linkTweet thisAlerts:
@jsladyauthorDec 02.2003 — thanks for that spufi.

Regards,

JsLady
×

Success!

Help @jslady 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.16,
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,
)...