Trip is in denial? CSS vs HTML

Originally posted by mr. K

And sogni - yes - you need to do *everything* that has to do with layout in your css. the html is supposed to be very minimal, just what you want to be on the screen - not how it should look on the screen.

Yeah, I realize this... and I know CSS - I've just been very lazy as far as CSS goes. :p

Also, see my previous message about a CSS editor.
 
Okay, I've posted a simple table example, maybe too simple, but it helps:

http://c-o2.net/tableEx/index.html

The first page doesn't validate (only for one reason, but if you multiply this one reason by the amount of time someone uses tables in their layout, then you can understand).

The second page does validate, and so does the CSS. If you look at the two page's code, you'll notice the code for the CSS version is smaller. Again, magnify this with the size of a normal layout and you begin to realise how much code you can begin to cut out, making everything faster, and more manageable.

NOTE:
By the way, the center CSS is happily working away in the <td>. ;)
 
Hmm...anyone have w3c's validator saying that pages are served as either text/xml, application/xml, or application/xhtml+xml? Any I've ever checked out always say it's being served as text/html - which isn't a bad thing, if your browser knows xhtml it'll still parse it as xhtml.

I was more or less just curious if anyone has seen any servers actually serving documents as only xhtml rather than html.

If you're wondering what I'm talking about, check out the Extended Validator.
 
YAY!
This Page Is Valid XHTML 1.0 Transitional!

That was just one page of the site I'm working on. Man XHTML is enough to drive someone nuts! heh :D

I'm sure my code is not great, but no complaints from the w3 xhtml validator! :)
 
Hydra?
This is planned for a future version of skEdit, BTW.

mr K.: you can use text-align left & right, they are in the specification. You can also use text-align center, and it goes through the validator alright. It just sucks that you can't do align: center & left & right.
The thing is you have to look at it differently. You can't just align an element to the center of the window, you have to align it to the center of whatever the parent element is.
You can align to the center of the window by aligning to the center of the <body> tag.

-EDIT-
All these things have already been answered....
 
Darkshadow - most web servers send anything with the .html extension as text/html, and that isn't how xhtml strict should be sent. To fix it ( I don't bother, Maybe if I actually published something to the web I would) just change the file extension to .xhtml or do some php magic or use apache to change the content-type http header. It can be done, and probably should be to assure the best rendering.
 
Sogni

This is the sticking point. You can centre textual elements via the CSS style, but it will not work with tables.

Here's a great link to centre your tables with CSS!:
http://www.granneman.com/webdev/coding/css/centerta/index

The bottom example (Method 3) is probably the best. Actually, Method 1 works great as well for fixed-width tables. ;) Method 1, as the site states won't work in IE5.5+. And we're all testing on Safari I guess :rolleyes: So, Method 3 it is then.

I've tested these on the previous example I posted in this thread. It's left with Method 1.
 
Originally posted by mr. K
Darkshadow - most web servers send anything with the .html extension as text/html, and that isn't how xhtml strict should be sent. To fix it ( I don't bother, Maybe if I actually published something to the web I would) just change the file extension to .xhtml or do some php magic or use apache to change the content-type http header. It can be done, and probably should be to assure the best rendering.

Um...yeah, I realize you can do this with your own server, but I was talking about other servers.

So, has anyone seen any other servers serve pages up as xhtml rather than html?

:p
 
Argh, I have so much to say about this but so little time/desire to organize my thoughts on this topic! More from me later, when it's not a couple hours from sunrise...
 
It's nice to see such a debate/discussion happening. Something I wish would happen more in this web tech part of macosx.com.

There doesn't seem to be as many web-developer-designers around here these days. So, nice to see us all talking.
 
Darkshadow - there also is a php way that will sniff the browser and send moz/opera/safari the application/xhtml+xml content header and any lower browsers text/html, check it at anne vankesteren's site. It actually sniffs for the http_accept header, and if that is xhtml+xml, then you get the real thing, otherwise text/html.
I thought I said that...
 
Yes, I do understand that. But a php script won't work for a site you're just visiting. It'll only work if you have access to the site, and can put that script there...have it be accessed...etc, etc. That's what I meant by saying that you can do it on your own server.

Mine was just a general question...maybe I just phrased it badly.

So...here, I'll try saying it this way. For any site that you surf to that you see is XHTML, and you're curious and validate it just to see if it validates, have you seen any that properly send it as text/xml, application/xml, or application/xhtml+xml rather than just plain text/html?

I actually haven't (well...ok, other than various ones at W3C, anyway ;)).

And like I said, it doesn't really hurt it any, most XHTML-aware browsers will parse the page as XHTML rather than plain HTML even if the content type was sent as text/html.

I'm just mainly curious to know how many XHTML pages out there are actually being served as XHTML.
 
Yeah, my mistake I misinterpreted your question. I don't know how you force your browser to parse a site and display it as xhtml+xml, but I'm sure there's some kind of hack you can find somewhere to do it. And yeah, it really doesn't make that big a difference how you send your pages, just make sure that they are well formed and no biggie.
 
Originally posted by Sogni
Uh, so how do I center a table?

margin: 0 20%; and you're done !
Stop thinking in non semantic terms. Don't look for a center command but simply think of a 20% margin on both sides...

CSS is just about thinking the Web another way. Check the 'semantics' link in my sig.
 
Honestly I don't want to do this. Something inside me says I should. But I don't want to. I need to start making money NOW, and the only way I can see doing that is by putting stuff together through GoLive. Meh, why am I still talking when I can't even draw?!

Thoughts?
 
Back
Top