Valid XHTML/CSS - More fun than a barrel of monkies!

dk01's picture

He has: 516 posts

Joined: Mar 2002

Well I have to say that I never thought validation would make any sense. I used toi get mad at everyone who preached it since it seemed to be so pointless. Wow was I wrong!

Ok there is obviously a trend to validate code now. Its not just another hassle of making a website but it is actually serving a function to make sure our sites will work on ALL browsers. There are still some problems but I beleive it is possible to code a good site writing standards code and have it work in all major browsers. What are your thoughts on validation and WHY? How about browsers. Which should be dumped from the list to debug in? Why does the w3c not want xhtml served as text/html anymore? Have you found any problems with XHTML/CSS and want them answered? Any other questions about the new stardards on the block? Have fun!
-dk

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

I totally agree with you. We're having a problem at work right now with an automated system (developed in-house) that isn't authoring standard code. This thing exports an entire site from a CMS so it can be distributed on CD, but the problem is that once it's exported, you can't edit it in Dreamweaver. Why? Not written to standard. If it was, DW would have no problems handling it. So, authoring to standards is really important in a mult-author environment. If I hand-code something, my co-worker can open it in Dreamweaver and work on it without a problem. Another co-worker can open it in a text editor and pick up where I left off, seamlessly. Yet another benefit Smiling

About browsers, I really wish we could dump IE 6 but that's not about to happen anytime soon Sad

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Continuing justlurkins comment from here.

Quote: That’s a very, very attractive design. Impressive job, dk! I do want make an observation about the vast majority of XHTML 1.1 sites that claim conformance to the W3 specs (yours included), however. Sending an XHTML 1.1 document with a media type of text/html is not allowed; the W3C’s validator will not catch this error. You might want to refer the chart in section 3.5 of this page: http://www.w3.org/TR/2002/NOTE-xhtm...types-20020801/

I think what he meant was was instead of having this:

text/html; charset=iso-8859-1" />

It is suppossed to be this:
text/xml; charset=iso-8859-1" />

Anyone care to comment?

They have: 6 posts

Joined: May 2003

I think I opened this “can of worms,” so here goes. A media type of text/html is allowed under XHTML 1.0 (as long as the document conforms to appendix C of the spec.), but XHTML 1.1 mandates one of the following media types: application/xhtml+xml, application/xml, or text/xml . See section 3.5 http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/. You will notice some significant changes in the way that your document is rendered when you start sending your pages as anything other that text/html. IE users, all versions and platforms, will receive a download prompt when a page is sent with the preferred media type of application/xhtml+xml. Netscape 4 tries to download anything other than text/html. Gecko and Opera 7 browsers seem to parse all allowed XHTML media types, but a page must be well-formed in order to display. You can test browser media support here: http://www.w3.org/People/mimasa/test/xhtml/media-types/

A few authors are sending application/xhtml+xml to browsers that understand it, and text/html to browsers that don’t. Here’s a link an excellent article by Mark Pilgrim: http://www.xml.com/lpt/a/2003/03/19/dive-into-xml.html.

I noticed the following when sending my pages as application/xhtml+xml to XML aware browsers: One missing closing tag will result in an XML parsing error page being displayed. My external JavaScript “broke” in various flavors of Netscape 6/7, Mozilla 1.4A, and Opera 7. Gecko browsers would not display the specified background color when a margin was declared in the body: body {margin: 10px; padding: 0; background: #666; color: #000;} resulted in a nice white 10px margin.

On the plus side, I did notice a significant speed increase when the pages were being rendered by an XML parser. I hope that someone has more positive experiences to share.

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Oops, sorry, I hadn't seen that other post in Critiques before I posted above Smiling Forget what I was talking about!

dk01's picture

He has: 516 posts

Joined: Mar 2002

Its fine megan whatever you want about xhtml and stardards is great.
-dk

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

What I don't like about the standards of XHTML Strict is that you cannot center tables or anything because you're not allowed 'align="center"' hell you're not even allowed the 'align=""' part.

Like Megan, I also want IE(6) gone, too many people are just producing bad code because 'it works in Internet Explorer' :S - however that's not likely to change
Another browser I want done is NS4.x, it just gives some of us more problems sure it might be a good browser but seriously, it could cost us the loss some of our best/regular clients because they listen to other people who view it in NS.
Opera6 on the other hand supports most of the CSS standards except for the ones that make the site look good and help with positioning. For example O6 doesn't or seems to not support 'right:npx;' for some strange reason.

At the moment, the only browser that I find is the best of them all would be Mozilla.

Smiling

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I think standards are really really important. However... I don't think that xhtml is the most important standard to author to.

In some situations, it's just not reasonable. You can achieve a great deal of benefit from using standard HTML 4.01 markup for some sites those audience is not ready to make the leap.

That said, I do attempt to push it to xhtml, but it's just not always reasonable.

Renegade: try using margins instead of "align". margin: 0 auto 0 auto; should center your table, or if you're using percentages for the table width, you can use margin-right: 12%, margin-left: 12%, and width: 76% for instance.

Standards are good definitely for the reasons Megan mentioned -- portability of the code. I'm also pleased with standard code as I can troubleshoot it easier, work with it faster, et cetera.

I am interested in the text/xml issue, mostly because it's not supported by anyone but Mozilla and derivatives yet and it makes JavaScript quite tricky! But it's a good thing. I'm seeing many applications (Konfabulator on the mac, RSS, et cetera) that use subsets of XML to excellent effect, making it possible to stretch the function of the web in a real way for many people -- serving pages properly is just the start of making that happen.

disaster-master's picture

She has: 2,154 posts

Joined: May 2001

Justlurkin, you said that "Sending an XHTML 1.1 document with a media type of text/html is not allowed".

Am I correct in saying that this should be replaced with:

And does this little snippet have anything to do with what we are talking about?

<?xml version="1.0" encoding="UTF-8"?>

They have: 6 posts

Joined: May 2003

The W3C is strongly encouraging application/xhtml+xml for XHTML 1.1 docs. The other two allowed media types, text/xml and application/xml, are more generic xml media types and user agents might not recognize some XHTML elements and attributes. I understand anyone’s reluctance to use application/xhtml+xml because it is not yet supported by Internet Explorer http://www.w3.org/People/mimasa/test/xhtml/media-types/results . Although there is nothing in the spec. that allows you to send XHTML 1.1 as text/html, some authors do serve application/xhtml+xml to UA’s that accept it, and text/html to those that don’t. This type of content negotiation is allowed and encouraged under the XHTML 1.0 recommendation however. Call me cynical, but I would be afraid to use XHTML 1.1 on a site that I do not maintain until IE becomes application/xhtml+xml aware, and the site has been tested thoroughly.

The code snippet is an XML declaration that is optional, but encouraged. The real kicker is that IE6 renders a document in "quirks mode" when the declaration is used. If you choose to omit the XML declaration, UTF 8 or UTF 16 character encoding must be specified.

They have: 5,633 posts

Joined: Jan 1970

I'm new to the valid XHTML camp, but it seems like a good thing to do in my book, so I'm trying to learn more. I found http://www.edgeofmyseat.com a useful resource and learned that I should set DreamWeaver's prefs so that new documents are XHTML compliant.

If you use PHAkt (or IMPAkt) to build PHP/ADODB sites, you might run into a problem with the first line of code:

<?xml version="1.0" encoding="UTF-8"?>'

To work around it, you can swap the first line of code in your PHP files with this:

<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<?php echo " \n"; ?>
'

If you use DW's built in PHP/mySQL server model, it does this for you when you create a new document.

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Quote: Originally posted by Renegade
Opera6 on the other hand supports most of the CSS standards except for the ones that make the site look good and help with positioning. For example O6 doesn't or seems to not support 'right:npx;' for some strange reason.

Try using v. 7 - it's CSS support is the best Smiling (although that site says that right: works in Opera 5, so I don't know why you'd be having problems).

dk01's picture

He has: 516 posts

Joined: Mar 2002

Yes opera 7 has very good support for js. They seem to be moving more in the right direction similar to mozilla. IE is still stuck in its non standards slump.
-dk

They have: 6 posts

Joined: May 2003

Couple of Opera 7 observations: Opera 7 does XML parse all allowed XHTML content types, but it doesn’t currently send anything other than text/html in it’s accept headers http://pgl.yoyo.org/http/browser-headers.php. If you’re testing for acceptance of something other than text/html and using content negotiation to send another content type to XML aware browsers, Opera 7 is still not rendering your page with an XML parser.

Opera did make an important XHTML enhancement with the release of 7.10. Documents with an XML declaration now render in “strict mode.” If your pages are susceptible to box model differences, you might want to view them with the latest release.

Busy's picture

He has: 6,151 posts

Joined: May 2001

The thing that gets me about the XHTML standards thing is a lot of people think XHTML is only the strict version. They try it, fails in the browsers so they give up using it.
No one worried about HTML standards while they were around and now people jump up and down because the browsers can't do XHTML strict properly, what ever happened to XHTML transitional ?
The other thing you have to remember is that CSS is NOT apart of XHTML, it's a side dish, but people seem to think CSS is XHTML.
[/end rant]

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

A number of people (including zeldman.com ) recommend using transitional for many reasons. I use strict for my own personal sites, and anything from html 3.2 to xhtml 1.0 strict for professional sites, depending on the client needs.

The thing with standards is that choosing ONE standard to follow, regardless of what that standard is, is the ideal. Different market, different standard. Well formed HTML 4.01 Transitional, using table layout with CSS augmentations? Super! Well done!

dk01's picture

He has: 516 posts

Joined: Mar 2002

Yes but the great thing is that even though css and xhtml seem sometimes to be closely entwined they are actually so much more separate than before. This means that although initial learing time may be longer, in the long run coders save time on sites. Now this is assuming that a person is fairly well experienced in html and things beforehand. I don't know if we are seeing anyone yet who comes in to the industry and goes directly to designing with web standards like xhtml. Instead there is advice given that says to learn html 4.01 first and then move along from there. This is fine but I am wondering what percentage of people actually decide to move on to xhtml after they start with html 4.01? I mean I would expect it to be a small percentage of webmasters. In this regard I am optimistic about whether standards will pick up and gather force or whether they will be this sort of suggestion that only a small percentage of websites actuallu use.
-dk

He has: 1,380 posts

Joined: Feb 2002

Personally, I just finished validating my code. It was a pain, but if you follow the instructions and the w3c.org site, its not that big of a deal. I think that XHTML is the one to validate to, as W3C is trying to push this, and since they pushed HTML (and it became standard) i think this is a good idea also.

XHTML strict isnt a big deal, i took a weekend and did it. It does make a difference, because it makes everything look almost the same.

As for the browsers, I believe anybody that wants to make a browser, should. Whether this is a company or person, it doesnt matter. The more you have, the more it forces you to comply to standards as a webmaster, making your site cross-platformed. And about IE and NETSCAPE, they have been around for awhile, and like old men, get grumpy and set in their ways.

dk01's picture

He has: 516 posts

Joined: Mar 2002

Quote: Originally posted by Eskater05
And about IE and NETSCAPE, they have been around for awhile, and like old men, get grumpy and set in their ways.

Hahah great metaphor! Well here is a great place to find browsers for any OS and even old versions of browsers:
http://browsers.evolt.org/

Wonder how they all treat standards.
-dk

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.