different layout results for html and xhtml

103 views
Skip to first unread message

Richard

unread,
Apr 11, 2010, 1:52:24 PM4/11/10
to dev-te...@lists.mozilla.org
Hi everyone,

I have a question about html and xhtml. The following code segment
gives different layout results when embedding in html and xhtml
document respectively.

<p>
<img width="90%" height="15%" src="attblk1.gif" alt="att.gif" />
</p>

Open this page (http://spe.mobilephone.net/wit/xhtmlv2/imageattr.xhtml)
with Firefox, the 2 images following "50% and 75% of screen width wide
(15% high should be ignored resulting in normal aspect ratio, Globe
should not be stretched)" are not stretched. But if i change the
source to a normal html syntax, the 2 images are stretched.

So it must be differences between HTML and XHTML. Can anyone give me
any pointers on this?


Thanks,

Richard

David E. Ross

unread,
Apr 11, 2010, 2:52:02 PM4/11/10
to

For HTML 4.01, the height attribute is not ignored even when a
percentage value is given. See
<http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.7.1>.

--

David E. Ross
<http://www.rossde.com/>.

Anyone who thinks government owns a monopoly on inefficient, obstructive
bureaucracy has obviously never worked for a large corporation. © 1997

Stanimir Stamenkov

unread,
Apr 11, 2010, 6:46:59 PM4/11/10
to
Mon, 12 Apr 2010 01:52:24 +0800, /Richard/:

> Open this page (http://spe.mobilephone.net/wit/xhtmlv2/imageattr.xhtml)
> with Firefox, the 2 images following "50% and 75% of screen width wide
> (15% high should be ignored resulting in normal aspect ratio, Globe
> should not be stretched)" are not stretched. But if i change the
> source to a normal html syntax, the 2 images are stretched.
>
> So it must be differences between HTML and XHTML. Can anyone give me
> any pointers on this?

I don't see any difference viewing the page as either XHTML or HTML.
I guess the difference with your other case "50% and 75% wide 25%
high of 100px high box" is that the computed height of the container
is an absolute length, while the computed height of the other
container is 'auto', i.e. it is not known so percentages of unknown
are effectively unknown.

--
Stanimir

Stanimir Stamenkov

unread,
Apr 12, 2010, 5:25:27 PM4/12/10
to
On 11.4.2010 г. 21:52, /David E. Ross/:

> For HTML 4.01, the height attribute is not ignored even when a
> percentage value is given. See
> <http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.7.1>.

Where is given the 'height' attribute is ignored for XHTML?

--
Stanimir

David E. Ross

unread,
Apr 12, 2010, 7:50:28 PM4/12/10
to

I have no idea what specification might say that. However, the original
message in this thread did say:


> 15% high should be ignored resulting in normal aspect ratio

I merely pointed out that, in HTML 4.01, this is not true. I gave no
opinion about XHTML.

Go back and read the entire original message.

Stanimir Stamenkov

unread,
Apr 13, 2010, 3:26:33 PM4/13/10
to
Mon, 12 Apr 2010 16:50:28 -0700, /David E. Ross/:

> On 4/12/10 2:25 PM, Stanimir Stamenkov wrote:
>> On 11.4.2010 г. 21:52, /David E. Ross/:
>>
>>> For HTML 4.01, the height attribute is not ignored even when a
>>> percentage value is given. See
>>> <http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.7.1>.
>>
>> Where is given the 'height' attribute is ignored for XHTML?
>
> I have no idea what specification might say that. However, the original
> message in this thread did say:
>> 15% high should be ignored resulting in normal aspect ratio
> I merely pointed out that, in HTML 4.01, this is not true. I gave no
> opinion about XHTML.
>
> Go back and read the entire original message.

I did read the original message and I did wonder why you didn't question
the statement you've quoted. Stating the height percentage is not
ignored for HTML alone made me think you're aware it is different for
XHTML somehow. Sorry, it could be my poor English but it haven't got
much point in the replies.

--
Stanimir

Reply all
Reply to author
Forward
0 new messages