/    Sign up×
Community /Pin to ProfileBookmark

How to fix this XHTML+CSS error?

Hi all,

I am new to XHTML, since I now discovered many web site are using XHTML + CSS, so I try to make one for myself.

Now, I have a peoblems taked, by after using the W3C’s “Validate Your Markup” to check my web page do it valid the XHTML 1.0 Trad or not, it show me this result, can suggest fix it by CSS, but I don’t know how to using the CSS to fix it, do anyone can teach me the better way to try for?

Thx

Line 31, column 34: there is no attribute “height”

<table width=”500″ height=”20″ border=”0″ cellpadding=”0″ cellspacing=”.

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the “Strict” document type with a document that uses frames (e.g. you must use the “Transitional” document type to get the “target” attribute), or by using vendor proprietary extensions such as “marginheight” (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.

to post a comment
CSS

14 Comments(s)

Copy linkTweet thisAlerts:
@mikepurvisNov 27.2004 — Basically, setting the height or width of [i]anything[/i] is considered 'presentational' data. The whole goal of xhtml is to completely strip presentational data out of the markup and move it into a stylesheet.

So instead of what you've got, you'd do this:

Markup:

[code=php]<link rel="stylesheet" href="style.css" type="text/css" />
<table id="maintable">
...
</table>[/code]


And then you'd have a file called 'style.css' which would contain this, among other things:
[code=php]#maintable {
height: 500px;
width: 200px
}[/code]


Now, before everyone jumps on your back about using a table for layout, you might consider checking out tableless layout. It's not easy, and broswers are a pain, but if it's your first one, you could start by ripping off one of the working and tested ones that exists in this reference document: http://www.glish.com/css/
Copy linkTweet thisAlerts:
@CharlesNov 27.2004 — [i]Originally posted by mikepurvis [/i]

[B]The whole goal of xhtml is to completely strip presentational data out of the markup and move it into a stylesheet.[/B][/QUOTE]
That's the whole goal of HTML 4.01 Strict and you should be using HTML 4.01 Strict. The whole goal of XHTML is to separate "well formedness" from "validity" so that you can do some error checking without the DTD and so that XHTML can more easily be combined with other mark-up languages.
Copy linkTweet thisAlerts:
@BonRougeNov 27.2004 — Hey Charles,

Can you explain that a bit more for me?

I've been wondering what the point of XHTML was. I know you can create your own tags, but they don't validate... So, what's going on?

Thanks for your time.
Copy linkTweet thisAlerts:
@BonRougeNov 27.2004 — Thanks, but I have read that before... Did I miss the bit where it says why my own tags don't validate?
Copy linkTweet thisAlerts:
@CharlesNov 27.2004 — "It is a reformulation of the three HTML 4 document types as applications of XML 1.0 [XML]."

If you write your own elements it will not be valid but it can be "well formed". But you're not supposed to just make up your own elements. Communities are supposed to write mark-up languages to suit their needs; MthML comes to mind. And one can use XHTML as the base for such things as XHTML/MathML. But you would need an XHTML/MathML DTD or schema to test for validity.
Copy linkTweet thisAlerts:
@BonRougeNov 27.2004 — So, a little person like myself shouldn't worry about xhtml then (although I use an xhtml strict DTD on my pages)? I should just use html 4.01?
Copy linkTweet thisAlerts:
@CharlesNov 27.2004 — You will not hurt anyting by using XHTML 1.0 Strict if, and only if, you follow the [url=http://www.w3.org/TR/xhtml1/#guidelines]Compatability Guidelines[/url].
Copy linkTweet thisAlerts:
@mikepurvisNov 27.2004 — [i]Originally posted by Charles [/i]

[B]That's the whole goal of HTML 4.01 Strict and you should be using HTML 4.01 Strict. The whole goal of XHTML is to separate "well formedness" from "validity" so that you can do some error checking without the DTD and so that XHTML can more easily be combined with other mark-up languages. [/B][/QUOTE]


All right then, thanks for the info. However, a CSS newbie's thread may not be the best thread for discussing such things.
Copy linkTweet thisAlerts:
@BonRougeNov 28.2004 — Mike,

Sorry if this seems like a waste of space to you. I think your answer was good for the poster and Charles was good to expand on it for anyone reading (like myself).

Charles,

Thanks for the pointers.

What I've been thinking about xhtml is that it might be easier to make tags myself and define them in the css rather than use something like <div id="whatever"> - I could just use <whatever></whatever> or something meaningful like the example in the W3C literature about music (<instrument>flute</instrument>).

It seems to me that the internet isn't just about 'communities' - people should be able to take the initiative themselves (of course with the help of good people like yourself).

This brings me back to the question about validation. If a page doesn't validate due to the tags not being standard tags, but the page is well formed as you say, does it matter?

Thanks again for your time.
Copy linkTweet thisAlerts:
@mikepurvisNov 28.2004 — [i]Originally posted by BonRouge [/i]

[B]Mike,

Sorry if this seems like a waste of space to you. I think your answer was good for the poster and Charles was good to expand on it for anyone reading (like myself).[/b]
[/quote]

Sorry to be short about it. As a frequent question-asker myself, I always get freaked out when someone drops a dump-truck definition that goes way beyond what's applicable in my situation -- sort of overwhelming.

[b]This brings me back to the question about validation. If a page doesn't validate due to the tags not being standard tags, but the page is well formed as you say, does it matter?[/B][/QUOTE]
In a perfect world, we'd surf XML pages and stylesheets would define based on purely the content pages where everything should go. Sites like the ZenGarden demonstrate that carefully constructed markup can be displayed in almost any way. However, in practice, a redesign of a multipage site is never quite so simple -- the order of the markup, the nesting and placement of auxiliary divs becomes very important.

As it is, you could write your site's entire content in XML, and then employ a simple server-side script that could grab the content and parse it into the tags defined by the XHTML DTD.

RSS is xml, of course, and any site that displays a news feed is basically the above -- taking raw content marked up as something else and turning it into content marked up for a web browser.
Copy linkTweet thisAlerts:
@BonRougeNov 28.2004 — I think my point is 'why do I need to parse it into xhtml dtd tags when the W3C literature tells us we can make our own tags (which we can - they just don't validate)?' Maybe W3C needs a new validator that will check your xhtml and css at the same time to see if they tally - ie. things like no block-level elements within inline elements - stuff like that.
Copy linkTweet thisAlerts:
@mikepurvisNov 28.2004 — [i]Originally posted by BonRouge [/i]

[B]I think my point is 'why do I need to parse it into xhtml dtd tags when the W3C literature tells us we can make our own tags (which we can - they just don't validate)?' Maybe W3C needs a new validator that will check your xhtml and css at the same time to see if they tally - ie. things like no block-level elements within inline elements - stuff like that. [/B][/QUOTE]


AFAIK, there are xml validators out there... it's just that a web browser can't make any sense of a raw xml doc. A more complex styling language than CSS is necessary to define its appearance.

A generic XML validator would operate using a Document Type Definition, though. Even if you're just making up tags as you go along, to be internally consistent, you want to define which ones the validator is to permit. So you write your own DTD, and then the validator will run your document against it.

At any rate, there's some good discussion on the topic on Zeldman's article about valid doctypes: http://www.alistapart.com/discuss/doctype
Copy linkTweet thisAlerts:
@BonRougeNov 28.2004 — I see (I think). Would it be acceptable to take W3C's dtd and add to it? Is that OK? I don't think I have the ability to do that - I'm not a programmer - but I'm curious.
×

Success!

Help @explorer1979 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...