Superscript (<sup>) and middle alignment in tables

J

jodleren

Hi

I have this (see code below).
Point: I want the bar to be aligned in the middle of the text, even
when with superscript.
The problem is, that the content in the 2nd <td> is top aligned at all
times.

Superscript is somewhat higher than normal text, but the following ts
does not align as I want it to. Can anyone help me here?

I have a dummy gif 14 pixels high 1 wide. Any gif can be used for
testing.

WBR
Sonnich

<table border="0" cellpspacing="0" cellpadding="0">
<tr><td valign="middle"><b>Day</b>&nbsp;</td><td
valign="middle"><b>Amount</b></td></tr>
<tr><td valign="middle">December 22<sup>nd<sup>&nbsp;</td><td
valign="middle">
<p><img src="graphics/bar.gif" height="14" width="125" alt="">&nbsp;
(125)</p>
</td></tr>
<tr><td valign="middle">December 21<sup>st<sup>&nbsp;</td><td
valign="middle">
<p><img src="graphics/bar.gif" height="14" width="33" alt="">&nbsp;
(33)</p>
</tr></table>
</td></tr>
</table>
 
D

dorayme

<[email protected]
m>,
jodleren said:
Hi

I have this (see code below).
Point: I want the bar to be aligned in the middle of the text, even
when with superscript.
The problem is, that the content in the 2nd <td> is top aligned at all
times.

Superscript is somewhat higher than normal text, but the following ts
does not align as I want it to. Can anyone help me here?

I have a dummy gif 14 pixels high 1 wide. Any gif can be used for
testing.

WBR
Sonnich

<table border="0" cellpspacing="0" cellpadding="0">
<tr><td valign="middle"><b>Day</b>&nbsp;</td><td
valign="middle"><b>Amount</b></td></tr>
<tr><td valign="middle">December 22<sup>nd<sup>&nbsp;</td><td
valign="middle">
<p><img src="graphics/bar.gif" height="14" width="125" alt="">&nbsp;
(125)</p>
</td></tr>
<tr><td valign="middle">December 21<sup>st<sup>&nbsp;</td><td
valign="middle">
<p><img src="graphics/bar.gif" height="14" width="33" alt="">&nbsp;
(33)</p>
</tr></table>
</td></tr>
</table>

Recheck your mark up here.

Is this the markup you want to know something about:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Title</title>
</head>
<body>
<table cellspacing="0" cellpadding="0">
<tr>
<td valign="middle"><strong>Day</strong>&nbsp;</td>
<td valign="middle"><strong>Amount</strong></td>
</tr>
<tr>
<td valign="middle">December
22<sup>nd</sup>&nbsp;</td>
<td valign="middle">
<p><img src="crimson.png" height="14" width="125"
alt="">&nbsp; (125)</p>
</td>
</tr>
<tr>
<td valign="middle">December
21<sup>st</sup>&nbsp;</td>
<td valign="middle">
<p><img src="crimson.png" height="14" width="33"
alt="">&nbsp; (33)</p>
</td>
</tr>
</table>
</body>
</html>

?

What?
 
J

Jukka K. Korpela

Scripsit jodleren:
I have this (see code below).

Post the URL, if you wish to create a constructive discussion.
Point: I want the bar to be aligned in the middle of the text, even
when with superscript.

Which bar? Is the bar open? What's your point?
The problem is, that the content in the 2nd <td> is top aligned at all
times.

No it isn't.
Superscript is somewhat higher than normal text,

Huh? You have done something odd. URL, please.
but the following ts
does not align as I want it to. Can anyone help me here?

Try wanting something else. Try posting a URL. Try explaining what you
are really doing.
I have a dummy gif 14 pixels high 1 wide.
Why?

Any gif can be used for testing.

Maybe, but we still want the URL.
<table border="0" cellpspacing="0" cellpadding="0">

Try using valid markup. A validator would help you.
<tr><td valign="middle"><b>Day</b>&nbsp;</td>

Using said:
<tr><td valign="middle">December 22<sup>nd<sup>&nbsp;</td><td

No wonder if you have problems - you have two <sup> start tags and no
end tag for either of them.
 
J

jodleren

Scripsit jodleren:

Post the URL, if you wish to create a constructive discussion.

Apearently you found the problem anyway below. The code was here and
is simple enough to work as a small file. Even without the picture.
Which bar? Is the bar open? What's your point?

Statistics. Save the file and you will see.

The bar. I agree that one pixel is enough. Just ended up that way and
it is only 884 bytes, same saize as it would have been for a 1x1 pixel
thing.
But my idea is to make some shades into it later. Not important right
now btw.
Try using valid markup. A validator would help you.
Agree.

Using <b> is a symptom of poor coding. Is this really a heading cell?

Yep. And why dont you like it?
Above is suggested said:
No wonder if you have problems - you have two <sup> start tags and no
end tag for either of them.

See? the code here is enough. And it is ok.
And I once again realise, that working to late is not always
good.... :)
Probably I'd have seen it today... when reading it over with a fresg
mind.
 
J

jodleren

Recheck your mark up here.

Is this the markup you want to know something about:

I tested it on validator.w3.org and it found 54 errors.
Some of them were my typos above etc and other simple stuff caused by
my tiredness yesterday. And it is ok on.

Still, I get some 26 errors mostly by nested tables... other pages
give none. I cannot see why they are different, as they are all based
on the same system and headers... but sometimes it claims that </td>
not allowed here and <tr height=... is not allowed, sometimes it is
ok. On of the better ones on </head> closing an unopened <head>, as
far as I can read, it is there... :)
I have a small htm file which I include in as first thing in all
files, so thay are all the same. But the validated result is
different...

Am I the only one seeing this?

WBR & merry christmas
Sonnich
 
J

Jukka K. Korpela

Scripsit jodleren:
Apearently you found the problem anyway below.

No, I didn't. I just mentioned some of the markup errors (which you
could have found yourself using a validator).

Do you want constructive discussion? If yes, why didn't you post the URL
now, after having been asked to?
The code was here and
is simple enough to work as a small file.

No it isn't. If you knew HTML, you would have realized this.
Statistics.

Statistics is a subject area, not a point.
Save the file and you will see.

No I won't. It was part of your homework to save it and post the URL.

You are not helpful in helping others to help you.
Yep. And why dont you like it?
Above is suggested <strong>.

Which part of the sentence "Is this really a heading cell?" did you fail
to understand.
See? the code here is enough.

It is enough for seeing that you have either misunderstood HTML or coded
sloppily without using a validator. It is not enough for seeing what you
are trying to accomplish - this would be the first part in finding a
good way to achieve it. Among other things, the &nbsp; looks suspicious.
Why do you use such a coarse and illogical method of creating padding,
instead of using CSS?
 
D

dorayme

<[email protected]
jodleren said:
I tested it on validator.w3.org and it found 54 errors.
Some of them were my typos above etc and other simple stuff caused by
my tiredness yesterday. And it is ok on.

Still, I get some 26 errors mostly by nested tables... other pages
give none. I cannot see why they are different, as they are all based
on the same system and headers... but sometimes it claims that </td>
not allowed here and <tr height=... is not allowed, sometimes it is
ok. On of the better ones on </head> closing an unopened <head>, as
far as I can read, it is there... :)
I have a small htm file which I include in as first thing in all
files, so thay are all the same. But the validated result is
different...

Am I the only one seeing this?

WBR & merry christmas
Sonnich

And best wishes to you too. I am a bit miffed at your above? I
included for you some html markup that was not error riddled and
was asking you if it was roughly what you had in mind and did you
have some specific question about it. But you are talking about
all sorts of errors as if you had not looked at my effort (which
was not meant to solve any problem but to supply, because it is
xmas, somthing a bit more error free).

But this xmas spirit is getting real strong today and I will go
one further, I will do what you are being urged to do by JK,
namely supply a url:

http://netweaver.com.au/alt/sonnich.html

Now is there some question you have about this (which is sort of
a mildly cleaned up version of yours - "it" does not have 54
errors)?
 
J

jodleren

Scripsit jodleren:



And the problem was...? I see no superscript there, and I see no <sup>
markup in the source. Is this about something completely different from
the Subject line's topic?

I do see an error message about some scripting error.

It was meant as an answer to Rob Waaijenberg
 
J

Jukka K. Korpela

Scripsit jodleren:
It was meant as an answer to Rob Waaijenberg

Are you completely clueless, or just making a great effort in imitating
cluelessness?
 
G

GTalbot

On Dec 23 2007, 4:14 pm, Rob Waaijenberg <[email protected]>
wrote:

Hello Jodleren,

You should change your doctype declaration to HTML 4.01 strict and
then correct all of the validation markup errors.

I highly and strongly recommend
Using Web Standards in your Web Pages:Making your page using web
standards - how to
http://developer.mozilla.org/en/doc...Making_your_page_using_web_standards_-_how_to

Nested tables should always be avoided.

The default vertical alignment in cell is middle in all modern
browsers; so there is no need whatsoever to add valign="middle" in all
your cells.

<font> is a deprecated, old, rusted HTML element. Please upgrade. You
will find how to do all this (convert bgcolor, replace <font>, how to
validate, etc) by consulting the "Using Web Standards in your Web
Pages" link I mentioned.

All of your webpage indicates over-constraining, over-declaring, over-
formating and over-attributes-specifying. You can reduce your webpage
markup code to half of what it is easily if you read a bit and then
keep your mind open about what people are trying to tell you in this
forum newsgroup.

Regards, Gérard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top