Forum Moderators: open

Message Too Old, No Replies

100% W3C Validation

2 Errors Away!

         

pageoneresults

8:12 pm on Feb 26, 2002 (gmt 0)

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



One of my goals since first stumbling across the W3C years ago was to build a site (or sites) that validate 100% to the W3C standards.

I am two errors away from 100% validation on most sites that I manage!

The errors that keep me from that 100% validation goal are...

Line 12, column 35:
... ad="preloadImages();" marginheight="0" marginwidth="0" backg ...
^Error: there is no attribute "MARGINHEIGHT" for this element (in this HTML version)

Line 12, column 35:
... s();" marginheight="0" marginwidth="0" background="images/ti ...
^Error: there is no attribute "MARGINWIDTH" for this element (in this HTML version)

These two attributes in my body tags are to control the margins in NS4. I've tried everything that I am aware of in getting these to work in external .css and cannot figure it out. Probably because there is no workaround if I want "0" margins in NS4.

Anyone care to chomp at this one a bit?!

Brett_Tabke

8:23 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



It's a tough one. Try this via css with NN4, set the margins to negative numbers:

body {
margin: -20px;
}

Brett_Tabke

8:37 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



On second thought, although the above works, some browser actually do shift the content -20. I'd never noticed that before.

hmmm.

Tedster - help. :-)

pageoneresults

8:40 pm on Feb 26, 2002 (gmt 0)

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



Hello Brett, pleasure meeting and chatting with you at the Bar Conference!

I tried the margin: -20px; as indicated and that works. Problem is, now the IE margin is at -20px even though I have the margins specified as 0px in my css. It looks like this now...

body{
margin-left:0px;
margin-top:0px;
margin-right:0px;
margin-bottom:0px;
background-color:#ffffff;
}

It looked like this when I added your suggestion...

body{
margin-left:0px;
margin-top:0px;
margin-right:0px;
margin-bottom:0px;
margin:-20px;
background-color:#ffffff;
}

At first I was jumping up and down for joy. Then I looked at the site in IE and saw the -20px margin, bummer! Any other suggestions?

mivox

8:55 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Instead of setting a margin attribute, try setting a position attribute for the body:

body { position: absolute; top: 0px; left: 0px }

Works in NN 4/Mac & Win for me (as well as IE 5/Mac&Win and Opera 5/Mac&Win)

I'm actually using the positioning on a div though... so if it glitches when used directly on the body tag, try this for your CSS:

#body { position: absolute; top: 0px; left: 0px }

and this for your HTML:

<body><div id="body">
[page content here]
</div></body>

pageoneresults

8:58 pm on Feb 26, 2002 (gmt 0)

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



mivox; I Love You! xoxoxo

That has solved the issue. Now I will make sure that my .css validates and if it does, I will be 100% W3C compliant!

P.S. Nice meeting you at the conference!

pageoneresults

9:04 pm on Feb 26, 2002 (gmt 0)

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



Okay, I don't love you just yet! After adding the suggested code to the css I ended up with javascript errors. When I take it out, the errors dissappear. I'm going to try the div method now and see what happens.

mivox

9:05 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



LOL... Glad to help! I beat my head on that one for a while too, and figure there's no need for anyone else to suffer a concussion over it. ;)

(My only non-compliance on my employer's site is wrapping a few DIVs in netscape <layer> tags for random positioning reasons... and since everyone else ignores the <layer> business, I'm not worrying about it. 99% compliance is good enough for me.)

pageoneresults

9:09 pm on Feb 26, 2002 (gmt 0)

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



Okay, I still love ya but not because I have the solution, but because of your contributions to the board and my knowledge!

I added the <div> element and still no luck. The margin issue is addressed but the javascript errors appears. Page loads fine, the rollovers for my navigation don't function!

mivox

9:14 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's the jscript error? I'm not using jscript rollovers on the site in question, so I'm dying to know what the conflict is....

(Why not use a:hover attributes for that nifty highlighter effect instead?)

pageoneresults

9:21 pm on Feb 26, 2002 (gmt 0)

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



I can't find out what the error is. I'm so used to using IE and have my preferences set to show me what the actual errors are and I can't figure it out in NS4.7.

I'm already using the a:hover for the link effects. Its the tabs at the top that use the rollover code.

P.S. As soon as I add the position: element to my css is when the javascript error appears and the rollovers don't work. Only NS4.7 though, works everywhere else.

mivox

9:31 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I hate to say it, but I'd forget about rollovers for NN4.7 then... Unless the rollovers reveal crucial information*, NN 4.7 users can live without them, without significantly diminishing their browsing experience.

*(Of course, javascript should never be used for crucial information anyhow! ;) )

brotherhood of LAN

9:35 pm on Feb 26, 2002 (gmt 0)

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



maybe you could use those negative co-ordinates and fill em up with keywords :)

pageoneresults

9:39 pm on Feb 26, 2002 (gmt 0)

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



All I want for Christmas is to validate 100% to the W3C standards! That's all!

I know, its not a big deal. But right now, its an ego thing. There has to be some way to drop the attributes from my <body> tag and "0" those margins in NS4, there has to be!

I've been bringing up this topic in various forums now for over 3 years and still have not been able to locate a solution.

At this point, I don't think there is one and I'll have to live with 99%. I hate 99%!

mivox

9:42 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is a way to zero the margins... just not with your rollovers. Hehe...

Check your stickymail.

tedster

9:47 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK, lets nail this for everyone's sake.

> I can't find out what the error is. I'm so used to using IE and have my preferences set to show me what the actual errors are and I can't figure it out in NS4.7.

In Netscape 4, you can type javascript: into the location bar to get more information on what the js error is.

pageoneresults

9:52 pm on Feb 26, 2002 (gmt 0)

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



You know, when the error occurs, that message appears in the status bar. What they fail to tell you is to enter the : after javascript. Since I'm no expert on java, I have no clue what it is telling me here. Works fine when the position: element is not in the body css.

JavaScript Error:
document[changeImages.arguments[i]] has no properties.

tedster

10:19 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How very odd - you only get this error when you use css to set a body div the way mivox suggested?

If that's so, it's probably because NN4 actually uses the javascript engine to execute css. That's a remnant of Netscape's earlier attempt at JSS (javascript style sheets) They kept their old code and used it to kludge css support up until version 6.

So how many different images do you rollover? The reason I ask is that I have a suspicion about the array fouling things up here, and you don't need to define an array to get rollover effects.

You could try to simplify your rollover code, as we developed in this thread: [webmasterworld.com...]

pageoneresults

10:29 pm on Feb 26, 2002 (gmt 0)

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



How very odd - you only get this error when you use css to set a body div the way mivox suggested?

Hello tedster! Adding anything to do with position: within the .css body is causing the javascript error.

Mivox and I have been communicating via sticky and she is going to provide me with an alternative to my javascript rollovers. I have some remote rollover effects and that is what we are addressing now.

Wish me luck, I've never really had to dig this far into javascript. Oh well, another sleepless night, sleepless day, they just all merge together and end up being sleepless weeks!

P.S. Take a look at the code of the home page listed in my profile. You'll see what I am up against. Maybe my designer created a nightmare for me! Either way, I'm going to get to the bottom of this and validate 100% W3C before the Sun comes up tomorrow morning! Or at least I'll try!

(edited by: pageoneresults at 10:32 pm (utc) on Feb. 26, 2002)

mivox

10:31 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm digging for alternate jscript right now... This is so EXACTLY the kind of problem that will keep me enthralled for a week straight until I find a solution, I couldn't resist.

I've used CSS and javascript on the same page before in NN4.7, so I know it can work. I think it's just a matter of finding a nice minimalist, hand-coded free jscript and making some slight modifications.

The jscript code was automatically generated, and I can't make heads or tails of it at first glance. Word to the wise: Don't generate your jscript code with anything but a text editor. It gets ugly really quickly.

tedster

11:25 pm on Feb 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What a fancy double rollover that is. Hmmm...

Are you just using the BODY element, or are you giving a div the name "body", as mivox is doing? If you are naming a div, then try naming it "main", or anything other than "body". Might be some code confusion generated by that name choice.

pageoneresults

11:29 pm on Feb 26, 2002 (gmt 0)

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



I'll be addressing all of this later this evening. I haven't been away from this computer since 0700 this morning and it is now 1531! I need to get a life and my main career beckons me!

Thank you so very much for your assistance! Mivox, I just sent you an e-mail with the correct .js for the index.htm page.

pageoneresults

1:10 am on Feb 27, 2002 (gmt 0)

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



Okay, I could not wait until later this evening, I pretty much burned a whole day here at the computer and WMW. I need to keep food on the table!

Anyway, we selected a different slice option from Image Ready (I thought he was using GoLive). Instead of generating tables, we utilized the css feature and absolute positioning. There were two options available; div id and div class. I've got two test pages up that mivox and I are looking at. If you'd like the URL's, send me a sticky and I'll send you the links.

Now everything works fine in NS4+ and IE5+ on Windows. Haven't checked in Opera yet but I'm sure all will be okay knowing how Opera works. I use Opera only because all the rest of you geeks in here use it and I want to make sure that what you see is what everyone else is seeing.

Me thinks that absolute positioning is the way to go instead of using tables for the main navigation structures that are sliced and diced. I'll await further replies on the div id and div class issue to see which way we go.

Thanks again to brett, mivox and tedster for your assistance, it is much appreciated. I can't wait to put that W3C icon on my site that says I validate 100% to the W3C standards. Woohoo! Woohoo! Woohoo! I got goose bumps!

I'd like to add that the Image Ready generated css validated 100% with the W3C.

P.S. mivox just e-mailed me the bad news that the rollovers are not working in NN4.7 for the Mac. That's okay, there are probably only a handful of Mac users using NN4.7 and I'm sure they would not be concerned about the rollovers!

Purple Martin

4:46 am on Feb 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> document[changeImages.arguments[i]] has no properties.

I've seen the JavaScript error "... has no properties" several times in the past, and it's a real pain. I think I stumbled across the solution last time: make sure you set both the NAME and ID attributes for the element in question, that way Netscape can find it and get to its properties. I haven't seen the error recently to test this theory with, so please don't shoot me if it doesn't fix it! :)

pageoneresults

4:57 am on Feb 27, 2002 (gmt 0)

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



I did it! I validated 100% to the W3C HTML 4.01 Transitional! I have mivox to thank for it, she has led me down the path of absolute positioning and its major advantages in both design and validation. Not to mention some of the neat things you can do to position your content wherever you want it to appear in the html.

In the next few days, I will be updating the site in my profile to validate completely. I have been on this issue since 0700 this morning, it is now 2057, almost 14 hours non-stop, except for a few federal mandated 15 minute breaks throughout the day! ;)

P.S. There is one minor problem. When I add my DOCTYPE above the <html> it throws the IE top margin out of whack. Aw man, back to the drawing board unless someone knows of a fix, help!

mivox

5:08 am on Feb 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Great feeling, isn't it? I agree the rollovers are unnecessary... as long as the links are functional, that's the important part. :)

tedster

6:31 am on Feb 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nice going!

And thanks for the push towards absolute positioning. A designer I work with created a very elaborate page with all absolutes 3 years ago. I didn't appreciate her savvy then nearly so much as I do now.

Brett_Tabke

6:40 am on Feb 27, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



In your doc type, don't use the full url, just use:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

pageoneresults

6:44 am on Feb 27, 2002 (gmt 0)

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



That did it! I could of sworn that I tried that earlier on. Thanks Brett!

P.S. Webe validated 100%! :)

pageoneresults

7:52 am on Feb 27, 2002 (gmt 0)

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



I just realized that there is not one table or cell on my page and it looks great! Mivox tells me that it looks fine in Opera and NN on the Mac.

Hurray! No more...

<table>
<tr>
<td>

Just trimmed quite a bit of fat out of the html too! If you are interested to see what it looks like, check out the profile and add /css-test.htm

Please forgive me, this just excites me to no end! I never realized how simple and convenient absolute positioning could be if used properly.

Oh, and for you Front Plague haters, that page was built in FP2002 with some handing coding thrown in.