Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: open
I changed the doctype to html 4.01 and I used a validator for html 4.01 and was shown 12 errors (which I removed, so that now the document validates). I had to change <br /> to <br>, etc., but there were a few more things, that have made me wonder:
1) This is the thing I found REALLY strange and am trying to make sense of:
The original template had a menu on the left side of the page. I changed a ton of the whole document and in the end I had a problem: the buttons of the left-hand side menu would frequently move to the right and back (and back) when I was moving the mouse over them! It's been a while since I started out with that template and I'm not sure anymore, if those were always the same buttons or if it happened to all of them, but obviously that was a BIG issue with the left-hand sie menu.
I don't remember the train of thought I had back then, but I thought using this line of code (for the highlighted/selected button):
instead of this one:
might remove the issue. I was surprised, because it actually did work! The buttons remained in the same place, now if I was moving the mouse cursor over the left-hand side menu.
However, this line of code didn't validate in the html 4.01 validator.
Now, I'm wondering: Why did it not validate? The reasons I was given were something along the lines "starting tag for li ommitted" or something like that which wasnt really true imho. Is it not allowed to place a span-element around a <li><a></a></li> element?
2) What is even more strange: Now, that I had to remove that span element and use the line of code I had used before:
is working perfectly! The buttons stay in the same place and don't move to the right. I tried to use the xhtml doctype again wondering if it was all about the doctype, but its even working with the xhtml doctype, now.
Is it possible that my using some xhtml-code caused this problem? Ive read the post of using xhtml to deliver text sometimes causing problems....maybe that was the case here? I somehow doubt it, to be honest, would be too cool an explanation :-).
is an inline element, whereas
is a block-level element - so you cannot place a
outside a list item and still validate.
The change of code should not be necessary (assuming you are using an appropriate doctype [webmasterworld.com]) - the problem is more likely to be with your CSS rather than your markup.
thanks for the replies! Actually, now it is working perfectly without the span-tag. But a few months before (I was busy in college, so didnt do anything with it) I had to make this change, because it wasn't working. I didn't change anything about the CSS, though! I also read that post you made on the appropriate doctype, which is why I went with html 4.01 as a doctype.
But...well, it's working now so I shouldn't complain, I guess ;)
Could I have placed a div element outside the li and a elements, because that would have been a block element? (I mean technically, even if it looks ugly ;))
It might have worked but it still wouldn't validate, as the only parent of an <li> element should be either <ol> or <ul>..
maybe, but more likely an IE hasLayout error possibly added to by a Quirks/Strict rendering mode difference?
can I just ask if this happened to be IE where you saw the "moving". In my experience moving menus, or to be more correct moving lists containing block level links is almost always an IE issue rather than a HTML/CSS coding one!
and the Doctype change could have fixed it for you if the switch also caused IE's rendering mode to change,
If you were you using the <xml prolog> before your XHTML one then that would've been putting IE into Quirks rendering mode (and that could've possibly invoked some older IE bugs!)
A simple swap from XHTML to HTML should not have caused code to fail/fix nor should you be required to invalidate (X)HTML to make it work.. if it does/did I guarantee there's something else going on
as you say it's not really an issue now if it's now working, but don't confuse the validation errors with a browser rendering bug is all I'm saying, You should never actually need to use invalid (X)HTML to fix a rendering error, regardless of if doing so actually fixes it.. we know how to fix any remaining rendering errors IE has and still keep code valid, so if you track it down or come across it again come over to CSS and see us :)
I didn't know that a <li> element should only have ol or ul as a parent element. Now, that makes sense, of course. Had I known it was incorrect code, I probably wouldn't have used the span-element to "fix" it (neither the div).
Unfortuantely, I dont know if it happened in firefox, too, because I started this design multiple months ago (had trouble in college and wasnt able to do any worko n that site), so I just dont remember..but it's possible.