Forum Moderators: open

Message Too Old, No Replies

Getting page to validate

leftmargin, topmargin and ul not allowed?

         

RussellC

4:36 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



I am trying to get my page to validate and I have come accross theses errors:

Below are the results of attempting to parse this document with an SGML parser.

^Error: there is no attribute "LEFTMARGIN" for this element (in this HTML version)

^Error: there is no attribute "TOPMARGIN" for this element (in this HTML version)

^Error: there is no attribute "MARGINWIDTH" for this element (in this HTML version)

^Error: there is no attribute "MARGINHEIGHT" for this element (in this HTML version)

^Error: element "UL" not allowed here; possible cause is an inline element containing a block-level element

Anyone know how I use CSS or something else to position the page with no margins so the page will validate? Also, whats with the <ul> tag, can I not use it in certain areas? Thanks.

-Russell

rewboss

4:46 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



You can use CSS to set the margin and padding properties of the body element to 0.

Is the <ul> nested inside a <p>?

RussellC

4:52 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



WOW thanks for the fast response. No ,the <ul> is not in a <p> does it need to be?

Also, how do i do the css? like this?

body {leftmargin: 0; topmargin: 0} etc...

is that right?

moonbiter

4:56 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



The first four properties are the Four Horsemen of non-validation. ;)

UL is a block level element and can only be a child of certain other block-level elements [htmlhelp.com].

RussellC

4:57 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



i figured this out

body { margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px}

moonbiter

4:58 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



body {leftmargin: 0; topmargin: 0}

Almost [htmlhelp.com]. ;)

RussellC

5:08 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



OK the only thing left is the <ul> tag. I don't think I understand what you guys mean. Here is and example of my code.

<td width="66%" valign="top">
<font size="2" face="Arial, Helvetica, sans-serif">
text:
<ul>
<li><a href="link.html">Link</a></li>
<li><a href="link.html">Link</a></li>
<li><a href="link.html">Link</a></li>
<li><a href="link.html">Link</a></li>
</ul>
text....
</font>
</td>

What do I have to change it to to make it work?

Thanks a bunch for the help! By the way...that CSS code dosn't seem to work in mozilla..i still see marigins in that browser.

pageoneresults

5:30 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



> By the way...that CSS code dosn't seem to work in mozilla..i still see marigins in that browser.

body{margin:0px;padding:0px;}

If you require "0" margins for all four properties; top, left, bottom, right, there is no need to declare each one.

P.S. I don't see any problems with your ul example. I would definitely consider getting that <font> tag out of there and using css to control font elements. You can also use css to control formatting with your td, ul and li.

RussellC

5:36 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



Thank you pageoneresults! That works. now for this pesky <ul> issue and i am valid! ...well at least the index page

pageoneresults

5:50 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Where is your <table> tag that houses the <td> element?

RussellC

6:00 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



it is within another <table> tag, then this:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="29%" height="244" align="right" valign="top"><a href="link.html"><img src="images/image.gif" alt="" width="174" height="222" border="0"></a>
</td>
<td width="5%"></td>
<td width="66%" valign="top">
<font size="2" face="Arial, Helvetica, sans-serif">
text:
<ul>
<li><a href="link.html">Link</a></li>
<li><a href="link.html">Link</a></li>
<li><a href="link.html">Link</a></li>
<li><a href="link.html">Link</a></li>
</ul>
text....
</font>
</td>
</tr>
</table>

do you think it could have something to do with where the <font> is?

pageoneresults

6:07 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



> do you think it could have something to do with where the <font> is?

That's exactly what it is. I took that same code, set up a test page, removed the font tag and it validated.

pageoneresults

6:08 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



For that code to validate using the methods you are, it would need to look like this...

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="29%" height="244" align="right" valign="top"><a href="link.html"><img src="images/image.gif" alt="" width="174" height="222" border="0"></a>
</td>
<td width="5%"></td>
<td width="66%" valign="top">
<font size="2">text: </font>
<ul>
<li><a href="link.html"><font size="2">Link</font></a></li>
<li><a href="link.html"><font size="2">Link</font></a></li>
<li><a href="link.html"><font size="2">Link</font></a></li>
<li><a href="link.html"><font size="2">Link</font></a></li>
</ul>
<font size="2">text.... </font>
</td>
</tr>
</table>

I'm going to suggest that you take the steps now to utilize css for your font attributes. This will eliminate any errors relative to font issues.

RussellC

6:11 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



Thanks! WHOOHOOO I'm valid. Thanks for the help everyone. I appreciate it. Now I have to edit the rest of my pages to validate them too! Thanks again.

pageoneresults

6:14 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Congrats!

Now, get this out of there...

<!-- <h1>Keyword Spam Here</h1> -->

Who taught you that?

moonbiter

8:43 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



> do you think it could have something to do with where the <font> is?

That's exactly what it is. I took that same code, set up a test page, removed the font tag and it validated

The ul element cannot be a child of a font element. Nor can any other block-level element, for that matter.

tedster

8:51 pm on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Next to the "four horsemen", I'll bet the most common validation problems people have involve this block level and inline element issue - especially around <font> tags and <p> tags in their legacy pages.

Once I grokked what that was all about, validation got pretty smooth. But I learned HTML in a very seat-of-the-pants fashion. If my code displayed well in IE and Netscape that was all I cared about in the beginning.

So, there have definitely been some bad habits broken as I learn the new ones.

RussellC

9:48 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



I am finding this with all of the pages I am trying to validate. I am doing some mad coding now to get all of my sites validated and it is totally changing my perspective on how to write the pages. I guess it will be all be worth it in the end.

g1smd

9:27 pm on Aug 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




> I guess it will be all be worth it in the end.

Yep. Sure will. Your page will have the biggest possible audience, across all web-browsing devices.

james gulliver

3:12 pm on Oct 7, 2002 (gmt 0)

10+ Year Member



i am validating a page and one of my errors is no ALT mising. what should i pput as the alt text?

RussellC

4:02 pm on Oct 7, 2002 (gmt 0)

10+ Year Member



You can put whatever you want really.

<img src="button.jpg" alt="description text">

Or if you don't want it to say anything you can leave it blank so it will validate like this:

<img src="button.jpg" alt="">

quiet_man

4:02 pm on Oct 7, 2002 (gmt 0)

10+ Year Member



James - if the image doesn't have an appropriate alternative description (eg. if it is just for spacing), you can just put an opening and closing quote tag for the alt and it should validate:
<img src="image.gif" height="n" width="n" border="0" alt="" />

SuzyUK

5:49 pm on Oct 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry I asked this question yesterday, but seeing as how you're talking validation here today...I hope you don't mind if I ask again. Because as it stands I can't find an answer to this anywhere...

I use ASP and believe it's very difficult to get ASP to validate, but I've been doing OK so far, until I hit the querystring..

I understand from various answers that to get it to validate

link.asp?a=b&c=d becomes: link.asp?a=b&amp;c=d

which is fine, but then when I try to read the query string value c=d
Validator is not reading it although my page is displaying fine (which it wouldn't do according to the validator code)

any ideas or have any of you hit this before?

tedster

6:16 pm on Oct 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm out of my territory here, so forgive me if this is crazy - would it work to substitute %26 for the offending ampersand?

SuzyUK

6:47 pm on Oct 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Tedster...

I tried it produces same results I also tried chr(38) after your promting...same there too :(

thanks for trying though

BTTDB then huh ;)

andreasfriedrich

9:23 pm on Oct 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use ASP and believe it's very difficult to get ASP to validate,

Me thinks itīs not only difficult, but next to impossible to validate ASP or any server side scripting language as HTML/XHTML. The good thing is, we donīt need or even want it to validate. All we want to validate and all that is sensible to try to validate is the HTML/XHTML document produced by the server side script. All we want our server side script to be is syntactically correct (which we cannot check using an SGML parser) and useful and fast and ...

but then when I try to read the query string value c=d
Validator is not reading it

Why would you want or even expect the validator to read, parse and understand your query string? The browser will decode the entities when it requests an URL which contains entity references. Then it is up to your server side scripting language to parse the query string.

The validator just checks whether a document conforms with a given document type definition.

So it comes down to this: The validator validates, the browser browses, the server serves ;) Donīt expect the validator to serve, the browser to validate or the server to browse.

Andreas

pageoneresults

10:05 pm on Oct 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



> Me thinks itīs not only difficult, but next to impossible to validate ASP or any server side scripting language as HTML/XHTML.

I'll have to disagree with that statement. I have more than a handful of sites using asp and they all validate. The only real problem that we ran into were unescaped ampersands and that was easy to fix. Any other errors were due mainly to improper nesting of elements that my programmer set up in his asp.

He and I have worked together to establish a set of guidelines for coding. Now we place the W3C html and css icons on every page of the site with the referrer URL query. Any time a change is made, we view the page in the browser and click that little icon to make sure we still validate. It has now become habit! ;)

SuzyUK

9:25 am on Oct 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Andreas

I also disagree, as I've always managed to validate my asp sites too, this was just an unusual problem, as HTML would validate, but when I "clicked on the validator icon", the validator was not reading the source code the same as mine, I was obviously parsing it first or I wouldn't just have had the one error!

:)

anyway problem is now fixed, I had the validator icon linking to a hard coded URI as I was testing from a local server, but I changed it to link to
"check/referer" and then uploaded it to server and this along with the escaped ampersands did the trick

Thanks to everyone for their input

Suzy

james_G

10:09 am on Oct 8, 2002 (gmt 0)

10+ Year Member



does a css style sheet have to have a document description header like a html page?

and how important is it that your style sheet conforms to standards?

if it doesnt conform to standard does it effectively mean that the pages linked to that style sheet are not valid html?

andreasfriedrich

1:41 pm on Oct 8, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When I wrote that it is next to impossible to validate ASP or any server side scripting language as HTML/XHTML I wanted to point out that the question of whether ASP, PHP, Python, Perl validate is a moot one, just as the question whether Google will index ASP or PHP pages.

All the validator or spider should and will ever see, assuming the server is configured correctly and your script is working ok, is an HTML document.

This is confirmed by Suzyīs statement: I changed it [the validator icon] to link to "check/referer" and this [...] did the trick.

The validator script will read the referrer from the HTTP header and will request that URL. The server that is named in the URLīs authority section will then serve the resource. If it is an ASPage the page will be parsed and the code executed. The result (hopefully a syntactically correct HTML document, no ASP/PHP/Perl is sent and there is not neccessarily a way to tell which technology was used to produce that HTML document) is then sent to the validator script which will validate it.

You can produce valid HTML with every scripting or programming language. The code that produces this valid HTML needs to be syntactically correct code according to that languages syntax.

Hope this clears things up.

Andreas

This 32 message thread spans 2 pages: 32