This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > May 2005 > Ending Tag Format Causes Problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Ending Tag Format Causes Problem
Tony LaPaso

2005-05-13, 7:27 pm

Hi all,

I'm not sure if this is an HTML issue or CSS issue but it's weird.

I've been working w/XML for 5+ years and it's always been true that you
can use a shorthand notation for an empty element like this:

"<fred/>" is the same as "<fred></fred>"


Well, I'm seeing a case where this is not true. Take a look at the
following two examples, if you would:


<div class='separatorBar'></div><p>hello</p>
<hr/>
<div class='separatorBar'/><p>hello</p>
<hr/>


These should be equivalent, right? It seems they are not. Firefox
v1.0.4 renders the two differently, as do IE 6 and Opera.

Here is the 'separatorBar' definition:

<style type='text/css'>
div.separatorBar {
margin-left:-10px;
margin-right: -10px;
border:solid;
}
</style>


What have I missed here? I though the <xxx/> notation was a shorthand
for <xxx></xxx>. Is this not true> Does anyone have an explanation for
my examples above?

Thanks.

--
Tony LaPaso




Alan J. Flavell

2005-05-13, 7:27 pm

On Fri, 13 May 2005, Tony LaPaso wrote:

> I'm not sure if this is an HTML issue or CSS issue but it's weird.


I don't think so. It appears you're failing to comform with Appendix
C of the XHTML/1.0 specification, that's all. Nothing "weird" about
that.
Jukka K. Korpela

2005-05-13, 7:27 pm

"Tony LaPaso" <tlapaso@comcast.net> wrote:

> I'm not sure if this is an HTML issue or CSS issue but it's weird.


It's basically an HTML issue; f'ups set accordingly.

> I've been working w/XML for 5+ years and it's always been true that
> you can use a shorthand notation for an empty element like this:
>
> "<fred/>" is the same as "<fred></fred>"


It's been true all the time and it still is true that the XMLized
version of HTML, called XHTML, which is what you are really trying to
use, is not ready for Web use. At least not without the precaution of
fooling IE & Co. into seeing it as old HTML, by applying Appendix C.

(If you don't know what Appendix C means, you haven't been paying
attention when you've read c.i.w.a.h. or your XHTML primer - or you
found a very poor primer.)

> <div class='separatorBar'></div><p>hello</p>
> <hr/>
> <div class='separatorBar'/><p>hello</p>
> <hr/>
>
> These should be equivalent, right?


They are equivalent by XML specification. The same specification tells
you should not use "self-closing" tags except for elements with EMPTY
declared content, when "interoperability" matters, and on the Web it
surely does. Ref.:
http://www.w3.org/TR/REC-xml/#sec-starttags

On the other hand, an empty div element is almost always a symptom of
bad design, and the class name virtually confirms this.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Tony LaPaso

2005-05-13, 7:27 pm

Okay, okay...I changed <div class='separatorBar'/> to <div
class='separatorBar' /> but there's no change in behavior. This issue
about a space before the "/>" is a 1999 issue. I can't believe the
latest version of Firefox needs that space. What's more, *both* IE and
Firefox are rendering differently based on whether or not I use <.../>
vs. <...></...>. Both browsers are consistent in this respect.

As usual, I should have been more explicit. I'm using (trying to use)
XHTML 1.0 Strict. Here's the DTD I'm using: <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">

I'm not using the XML prolog so IE 6 is not in "quirks mode".

Actually, forget about IE 6 -- it's hopelessly out of date from a
standards perspective. I am concerned about the way Firefox is
rendering it. Firefox seems to generally be pretty standards compliant.

So, still I get the same behavior. Is there something special in
Appendix C I'm missing?

BTW, what is "f'ups" and "c.i.w.a.h" mean?

--
Tony LaPaso


"Jukka K. Korpela" <jkorpela@cs.tut.fi> wrote in message
news:Xns9656636BE54jkorpelacstutfi@193.229.0.31...
> "Tony LaPaso" <tlapaso@comcast.net> wrote:
>
>
> It's basically an HTML issue; f'ups set accordingly.
>
>
> It's been true all the time and it still is true that the XMLized
> version of HTML, called XHTML, which is what you are really trying to
> use, is not ready for Web use. At least not without the precaution of
> fooling IE & Co. into seeing it as old HTML, by applying Appendix C.
>
> (If you don't know what Appendix C means, you haven't been paying
> attention when you've read c.i.w.a.h. or your XHTML primer - or you
> found a very poor primer.)
>
>
> They are equivalent by XML specification. The same specification
> tells
> you should not use "self-closing" tags except for elements with EMPTY
> declared content, when "interoperability" matters, and on the Web it
> surely does. Ref.:
> http://www.w3.org/TR/REC-xml/#sec-starttags
>
> On the other hand, an empty div element is almost always a symptom of
> bad design, and the class name virtually confirms this.
>
> --
> Yucca, http://www.cs.tut.fi/~jkorpela/



Richard Cornford

2005-05-13, 11:28 pm

Tony LaPaso wrote:
<snip>
> So, still I get the same behavior. Is there something
> special in Appendix C I'm missing?

<snip>

Probably the most important aspect of Appendix C is that you send
Appendix C documents with a content type header of 'text/html' (or
possibly do content negotiation and only send text/html as the content
type for browsers that don't admit to understanding XHTML).

A browser receiving a document with a content type header asserting that
the contents are text/html will interpret that document as HTML (what
else could they do?). Appendix C relies on the content being interpreted
as tag soup HTML with syntax that is within the known error-correction
behaviour of existing browsers. Thus the browser error-corrects the
document back to HTML, and creates an HTML DOM for it.

In HTML there is no shorthand, and that penultimate slash in a tag is
interpreted as an error in the mark-up, which is just ignored (not
strictly correct, but that is what happens). Thus <div /> becomes an
opening div tag for which there is no corresponding closing div tag. The
corresponding closing div tag will probably be inferred by the browser
in a position just before the containing element is closed.

Richard.


Eric B. Bednarz

2005-05-13, 11:28 pm

"Tony LaPaso" <tlapaso@comcast.net> writes:

> Okay, okay...I changed <div class='separatorBar'/> to <div
> class='separatorBar' /> but there's no change in behavior. This issue
> about a space before the "/>" is a 1999 issue.


Prince had a 1999 issue I seem to recollect.
Compatibility apart, you have already been told why you shouldn't do
that in the first place...

> I can't believe the
> latest version of Firefox needs that space. What's more, *both* IE and
> Firefox are rendering differently based on whether or not I use <.../>
> vs. <...></...>. Both browsers are consistent in this respect.


....but since you are obviously advertising text/html anything that
happens is a feature.

> As usual, I should have been more explicit. I'm using (trying to use)
> XHTML 1.0 Strict. Here's the DTD I'm using: <!DOCTYPE html PUBLIC
> "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
>
> I'm not using the XML prolog so IE 6 is not in "quirks mode".


You just quoted (part or all of) the prolog; you could spare yourself
some quality time if you locate and read the specs right away instead of
of getting confused by helpful misinformation (webstandards.org and
such) first.

> BTW, what is "f'ups" and "c.i.w.a.h" mean?


Since I'm replying to this in a 'c.i.w.a.s.', it means you need to
install a newsreader to participate on Usenet.


--
| ) Più Cabernet,
-( meno Internet.
| ) http://bednarz.nl/
Tony LaPaso

2005-05-14, 7:23 pm

Thank you all... I changed the content type to application/xhtml+xml
and Firefox rendered it like a charm!

I'm a little new to CSS and trying to get my site up to standards and
so some of my questions might seem a little simple. But thank you all
for responding.


--
Tony LaPaso




"Tony LaPaso" <tlapaso@comcast.net> wrote in message
news:6rmdncNMBqjojxjfRVn-qg@comcast.com...
> Hi all,
>
> I'm not sure if this is an HTML issue or CSS issue but it's weird.
>
> I've been working w/XML for 5+ years and it's always been true that
> you can use a shorthand notation for an empty element like this:
>
> "<fred/>" is the same as "<fred></fred>"
>
>
> Well, I'm seeing a case where this is not true. Take a look at the
> following two examples, if you would:
>
>
> <div class='separatorBar'></div><p>hello</p>
> <hr/>
> <div class='separatorBar'/><p>hello</p>
> <hr/>
>
>
> These should be equivalent, right? It seems they are not. Firefox
> v1.0.4 renders the two differently, as do IE 6 and Opera.
>
> Here is the 'separatorBar' definition:
>
> <style type='text/css'>
> div.separatorBar {
> margin-left:-10px;
> margin-right: -10px;
> border:solid;
> }
> </style>
>
>
> What have I missed here? I though the <xxx/> notation was a shorthand
> for <xxx></xxx>. Is this not true> Does anyone have an explanation
> for my examples above?
>
> Thanks.
>
> --
> Tony LaPaso
>
>
>
>



Tony LaPaso

2005-05-17, 11:32 pm

Thank you all... I changed the content type to application/xhtml+xml
and Firefox rendered it like a charm!

I'm a little new to CSS and trying to get my site up to standards and
so some of my questions might seem a little simple. But thank you all
for responding.


--
Tony LaPaso




"Tony LaPaso" <tlapaso@comcast.net> wrote in message
news:6rmdncNMBqjojxjfRVn-qg@comcast.com...
> Hi all,
>
> I'm not sure if this is an HTML issue or CSS issue but it's weird.
>
> I've been working w/XML for 5+ years and it's always been true that
> you can use a shorthand notation for an empty element like this:
>
> "<fred/>" is the same as "<fred></fred>"
>
>
> Well, I'm seeing a case where this is not true. Take a look at the
> following two examples, if you would:
>
>
> <div class='separatorBar'></div><p>hello</p>
> <hr/>
> <div class='separatorBar'/><p>hello</p>
> <hr/>
>
>
> These should be equivalent, right? It seems they are not. Firefox
> v1.0.4 renders the two differently, as do IE 6 and Opera.
>
> Here is the 'separatorBar' definition:
>
> <style type='text/css'>
> div.separatorBar {
> margin-left:-10px;
> margin-right: -10px;
> border:solid;
> }
> </style>
>
>
> What have I missed here? I though the <xxx/> notation was a shorthand
> for <xxx></xxx>. Is this not true> Does anyone have an explanation
> for my examples above?
>
> Thanks.
>
> --
> Tony LaPaso
>
>
>
>



Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews