HTML Standards Question

J

Jason Gogela

Does anyone out there know why I should care whether a <span> is nested in a
<p> or vice versa? What is the bennafit of adhering to this standard? It
seems to me that regardless of which way you write it, the page will render
the same, sans errors, in any browser. All responces will be greatly
appreciated.

~Jason Gogela
 
G

Guest

Hi Jason,

Believe it or not standards do matter. If you adhere to standards, your
pages will look the same across all browsers. When you "bend the rules", the
browser has to make a decision of how to interpret your HTML and there is no
guarantee the browsers will decide the same way. This particular standard
may not seem important to you, but if you get in the habit of obeying all
standards, it will save you headaches down the road. If you break standards
you are going to end up with tons of work having to be redone because some
client will tell you that your app doesn't run in the latest version of some
obscure browser. Obey them all and theoretically, you won't have any issues
(or at least a lot less). I could go on and on, but there are two big
reasons why standards are good. First off, XHTML is beautiful. When you
want to manipulate a page with XSL and morph it into something different on
the fly, you'll be glad your HTML is XML (and well formed). Second off, I
have a handheld. It has IE--not some WAP crap, but Pocket IE. It is a
pretty cool browser, I can go to any "normal" web page, but it looks a heck
of a lot better if it was standards compliant (and it loads a LOT quicker).
The world's changing and we don't just have to program for IE and FireFox on
Windows anymore, the next visitor to your page could be someone on a phone!

Oh, so the answer to your question is kind of like the old "cause I'm your
father and I said so", if it is a standard the w3c made it up for a reason,
so do it. Also, a SPAN is an inline element and a P is a block element. You
are not supposed to put block elements (like DIVs) in inline ones.

Tim
 
M

Merk

<< Believe it or not standards do matter.>>
Good start - nice and condescending.

<<if you get in the habit of obeying all standards,>>

Oh, come on. Believe it or not, the HTML standard is one of the biggest
piles of cr@p out there. You present the case that *all* standards can be
followed perfectly and consequently *should* be. Even if you were to do it
the browers all interpret the inadequate HTML standard on their according to
their creator's ideas of the way things should be.

<<If you adhere to standards, your pages will look the same across all
browsers>>
That is simply false: Have you ever seen the box model and all the problems
different browser implementations have created for us in their differing
implementations? If not, you can read up a bit at
http://www.quirksmode.org/css/box.html

Basically your direct implication that life will be good if we were to only
follow the standards carefully is bunk BECAUSE the browsers don't do it
themselves. You follow the standards and the browsers will screw things up
for you.

<< Obey them all and theoretically, you won't have any issues >>
Good grief man! Do you actually think that? What about all those depracated
tags (<FONT... ./> etc.)

<<"cause I'm your father and I said so" ----- if it is a standard the
w3c made it up for a reason, so do it>>
Enjoy your Coolaid man (appologies to Bill O'Reilly)

<< First off, XHTML is beautiful>>
Point well taken - but you are advocating following ALL standards (read your
OP if you don't think you said that).
 
G

Guest

Merk,
If only we could all be as ignorant as you... you probaably have one of
those websites that are advertising FireFox--getting $1 each user you
"convert", as long as they have the Google (DataMining) Toolbar...

Evidently, you've never heard of a DOCTYPE. The word DEPRECATED means don't
use it, we're phasing it out. I don't advocate following all standards, if
you use the DOCTYPE, you can tell the browser which standards you are
following. Finally, Kool-Aid is spelt with a "K", moron.

Wow. You're pretty uptight.
Tim
 
M

Merk

<< Finally, Kool-Aid is spelt with a "K", moron >>

LOL

I guess you would be the expert on that!

Say "Hi" to Jim...
 
K

Kevin Spencer

Oh, come on. Believe it or not, the HTML standard is one of the biggest
piles of cr@p out there.

Incorrect. Standards are extremely important, for reasons that you
apparently do not realize or understand, and Tim apparently does not either.
Let me see if I can explain. I'll start with a bit of history.

Back when HTML was first developed, the WWW could probably have been
accurately dubbed the "Wild West Web." There were standards for the most
basic types of things, like network protocols, SMTP, NNTP, and HTTP, but
that was about it. HTML, which relies on the HTTP transport, is still an
HTTP message. The markup used, based on SGML (Standardized Graphics Markup
Language), was a brand-new invention, developed with very little
forethought. Nobody imagined how popular it would be, what it could
potentially be used for, or what could be done over the Internet. HTML was
simply a markup language which could be used to graphically format
heretofore plain text messages in static documents. It was a great idea that
was poorly thought-out.

It became *extremely* popular in a short period of time, and soon, everybody
and their brother (or sister) wanted to get online and surf. Now, all that
was necessary to view HTML documents was a piece of software that could read
and interpret HTML, and, due to its popularity, a whole slew of software
companies started writing browsers to interpret and display it.

The popularity of it quickly fueled the demand to be able to do more with
it. Humanity was not satisfied with static documents, and competition being
what it is (a fact of life), HTML began to be extended. Unfortunately, as I
mentioned earlier, it was not designed with extensibility on the scale that
was demanded in mind. New tags sprang into existence. Who developed them?
Why, the software companies that manufactured the browsers, of course. After
all, competition being what it is (a fact of life), every browser
manufacturer wanted their browser to be able to do more than every other
browser manufacturer's did. JavaScript reared its ugly head, and now HTML
could do all sorts of tricks. Again, who determined what the Document Object
Model (a brand new concept at the time) would be, and how JavaScript would
work with it? You guessed it: the browser manufacturers. And so began the
infamous "Browser Wars" of the late 1990's.

Those were bloody times indeed. Not only were the manufacturers competing
against each other with every available weapon at hand, including the U.S.
Federal Court System, but there was horrible collateral damage as well.
Users all over the globe were bewailing the fact that certain things didn't
work in their favorite browser. HTML developers were crying out in pain over
having to study all sorts of documentation in order to make their web pages
work in all browsers (at least the most popular ones). Their clients were
wailing, and asking *why* the web sites they paid good money for looked so
much different in different browsers, and of course couldn't understand the
technical reasons given them by their contractors. And all the while,
competition being what it is (a fact of life), new technologies were
proliferating like rabbits; ASP, PHP, Cold Fusion, CSS, ActiveX, Shockwave,
Java Applets, the list is too long and frightful to write.

Meanwhile, a consortium of professionals, who realized that if the situation
got much worse, the "Powers That Be" would start to meddle in the affairs of
the Internet, decided to work out some standards, which would level the
playing field somewhat, and provide some semblance of sanity for all those
poor AOL users and Couch Potatoes who had enough trouble filtering all their
SPAM and cleaning out all the viruses they caught from their flirtations
with porn sites and other less-reputable districts of the WWW. Nobody wanted
any "Imperial Interference" from the "Powers That Be" to destroy what was
arguably a really good thing, in the way that only the "Powers That Be" are
capable of.

And so, these Standards organizations were formed, in a truly egalitarian
spirit. Anyone could participate. Everyone would agree to leave their
lawsuits at the door. And the Five Families of the Internet came together
and formed a "Cosa Nostra" for the WWW.

Fast forward to the present.

We are now in a "transitional phase" as a result of all this. The Five
Families have agreed in principle to adhere to these standards, for the good
of everyone. After all, there are plenty of other ways to compete, without
making all the soccer moms bawl their eyes out, and having to make a
plethora of lawyers wealthy instead of spending our money on new
technological toys to play with.

But these things take time. In fact, the invention of XML, and all of its
derivatives, has led to some really promising possibilities. XML is
self-describing, extensible, and simple. The permutations of it are complex
and infinite, but the language itself is a thing of simple, but strict
beauty. It is cross-platform compatible, since text is text (at least since
Unicode, another *gasp* standard, came out). Eventually, HTML will quietly
fade away, along with all of our memories of the browser wars, and all that
brou-ha-ha.

In the meantime, though, we still have some issues to deal with. But we may
remain confident in the knowledge that things are getting better. As a web
application developer, I can say that this is truly a *good* thing!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.
 
K

Kevin Spencer

Hi Jason,

As was mentioned in passing by another respondent, a <span> tag is an inline
tag, and a <p> tag is a block tag. If you put a <p> tag inside a <span> tag,
I don't know how different browsers would handle it, as a block tag is in a
line by itself by definition, and an inline tag is "in line" with the tags
that surround it, also by definition.

Perhaps it might look the same in whatever browser you're using, and for all
I know all different browsers may handle this error in the same way
(whatever that is). But what if you need to do something with the style of
either one? What if you want to do some JavaScript magic with either one?
And this is dynamic HTML we're talking about here (we are talking about
ASP.Net here, right?). How is this going to affect the output of your app?

A browser is software. Good software handles exceptions gracefully. But how
exceptions in markup are handled is largely dependent upon the software that
handles them. Browsers expect certain symbols, and they expect those symbols
to adhere to a set of rules. When those symbols break the rules, all bets
are off.

So, why should you care whether a <span> is nested in a <p> or vice versa?
Well, how difficult do you want your life to be? How much do you care how
your HTML is going to look in different browsers? If your client complains
after you release your software to them (we are talking about ASP.Net here,
right?), are you willing to slog through all your code to find the causes of
the badly-formed HTML in your output? Or would you prefer to do it right the
first time, and only have to deal with a minimal set of problems?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Complex things are made up of
Lots of simple things.
 
E

Erik Funkenbusch

Does anyone out there know why I should care whether a <span> is nested in a
<p> or vice versa? What is the bennafit of adhering to this standard? It
seems to me that regardless of which way you write it, the page will render
the same, sans errors, in any browser. All responces will be greatly
appreciated.

~Jason Gogela

The easiest answer is that browsers are virtually guaranteed to follow the
standards in the future, while quirky behavior may disappear. (Please, no
jokes about IE standards support, MS is making great efforts to follow
standards lately and should be commended).

The standard defines the way the browser should interpret the html/css.
There is no guarantee that browsers will continue to work with malformed
code.
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top