473,390 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

Ending Tag Format Causes Problem

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


Jul 21 '05 #1
6 2372
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.
Jul 21 '05 #2
"Tony LaPaso" <tl*****@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/
Jul 21 '05 #3
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" <jk******@cs.tut.fi> wrote in message
news:Xn***************************@193.229.0.31...
"Tony LaPaso" <tl*****@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/

Jul 21 '05 #4
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.
Jul 21 '05 #5
"Tony LaPaso" <tl*****@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/
Jul 21 '05 #6
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" <tl*****@comcast.net> wrote in message
news:6r********************@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

Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rusty Shackleford | last post by:
I have a Summer in front of me without any school, and I'd like to add a new format for python print strings that will show any number in a binary representation. For example: >>> '%b' % 3 11...
14
by: Tony LaPaso | last post by:
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...
3
by: Just D | last post by:
Did anybody see this bug? I tried to reproduce that using 12-hour and 24-hour system settings. Anyway it still causes a problem in VS2003. When I convert DateTime to a string using default...
5
by: raffelm | last post by:
I'm struggling to find a way to include long path names in a command line argument string that I have to build at runtime. I need to create a string like -o:"c:\my documents\my file.txt". ...
1
by: Manlio Perillo | last post by:
Regards. The problem is this code: >>> import email.Message >>> msg = email.Message.Message() >>> msg = "email bug" >>> msg = "Manlio Perillo" >>> print repr(msg.as_string()) 'subject:...
2
by: barry.edmund.wright | last post by:
Hi All, I want to build a Find Statement on the fly. The code below starting with 'This Code Works! is fine but as I said I want to build the Me!cboSelect1 & "=" & rs(Me!cboSelect1) portion of...
34
by: Umesh | last post by:
I want to extract a string abc*xyz from a text file. * indicates arbitrary no. of characters. I'm only able to do it when the string has definite no. of characters or the string length is...
1
by: Maciej07 | last post by:
Hello, We are using SQL server 2000 on W2k Server and MS Access 2000 ADP (like front-end). Now we try to change operating system for SQL Server 2000 from W2k to W2k3 and we found problem with...
15
by: cephal0n | last post by:
I have a technical Date problem that's really difficult for me, I have a "custom made" Date format MM.DD.YY this is actually extracted from SAP and theirs no other format option offered such as...
30
by: Adam | last post by:
Hi, I have a simple printf-like function: int print(const char *format, ...) { char buffer; va_list argptr; int i;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.