XHTML Validation problems

Status
Not open for further replies.

HeadlessCow

Ars Tribunus Militum
2,623
My roommate is having trouble getting the webpage for our project to validate as XHTML 1.0 Strict.

Here is a link to the validator output for our page. It's complaining about the select element but, as near as we can tell, it should be correct. select is listed in the dtd as both an inline and a block level element.

If anyone happens to know how to fix it we'd greatly appreciate it.
 

Greg Hines

Ars Tribunus Militum
1,686
Subscriptor++
The fix to this doesn't really seem logical, but this is how the W3C thinks it should be and so it is.

Try enclosing the <code><select></code> element within a block-level element such as <code>

</code>. So the relevant block of markup would look like this:

Code:
<code><div class="box">
	<div class="cap">Theme</div>
	<form class="theme" action="#">
		<p>
			<select class="dropdown" name="themeselect" 
			onchange="setActiveStyleSheet(form.themeselect.options[form.themeselect.selectedIndex].value); return false;">
				<option value="bubbles" selected="selected" disabled="disabled">Select one</option>
				<option value="bubbles">Bubbles</option>
				<option value="blossom">Blossom</option>
				<option value="buttercup">Buttercup</option>
			</select>
		</p>
	</form>
</div></code>

Try that and see if it works (it did when I uploaded a copy of that portion of the markup and validated it).
 

Greg Hines

Ars Tribunus Militum
1,686
Subscriptor++
Originally posted by HeadlessCow:
Yep, that portion was borrowed from arsware.org. :)

That fix is horribly ugly but we'll try it out. Thanks
Actually, looking at it again, I should have modified it a bit more to make a bit more sense. Try putting the word "Theme" in the paragraph instead of a <div> element. So the markup would then look like this:
Code:
<code><div class="box">
	<p class="cap">Theme
		<form class="theme" action="#">
			<select class="dropdown" name="themeselect" 
			onchange="setActiveStyleSheet(form.themeselect.options[form.themeselect.selectedIndex].value); return false;">
				<option value="bubbles" selected="selected" disabled="disabled">Select one</option>
				<option value="bubbles">Bubbles</option>
				<option value="blossom">Blossom</option>
				<option value="buttercup">Buttercup</option>
			</select>
		</form>
	</p>
</div></code>
All I did was change the <div> to a

element (keeping the same class) and then having the

element wrap around the whole form. This way you've got your text in a text container and you can appease the W3C validator gods.

EDIT: Man, using tabs looks REALLY ugly when they're 11 characters wide. I'm used to having tabs displayed as four characters wide in my text editor. I wonder if there's a way to change the appearance of that. If not, it may be something to propose for a future CSS spec... or something...
 
Status
Not open for further replies.