...

View Full Version : Can't get to validate



nickelsto
10-01-2004, 11:56 PM
My code validates except for one error:

"Line 40, character 26:
<ul id="submainlist">
^
Error: element UL not allowed here; assuming missing LI start-tag"

I included the HTML, then the CSS below. This page works fine in Netscape, gets buggy in IE. Can anyone tell me why the Error?

This is the HTML:
<div id="maincontainer">
<ul id="mainlist">
<li><a href="/index.html">Home</a>
<li><a href="/renopener.html">Instruments</a></li>
<li><a href="/Pricelistframe.html">Price List</a></li>
<li id="active"><a href="/salesinfo.html" id="current">Contact Us</a></li>
(LINE 40 IS HERE) <ul id="submainlist">
<li><a href="/rick.html">About Rick</a></li>
<li id="subactive"><a href="#" id="subcurrent">Links</a></li>
<li><a href="/privacy.html">Privacy Notice</a></li>
</ul>
</li>
<li><a href="/forum/phpBB2/">Discussion</a></li>
</ul>
</div>


And here is the CSS:
#mainlist
{
position: relative;
width: 100%;
height: 1.05em;
margin: 0;
padding: 0;
border-bottom: 3px solid #f63;
white-space: nowrap;
}

#mainlist li
{
float: left;
margin: 0 0 0 2px;
border-width: 1px 1px 0 1px;
border-style: solid;
border-color: #aaa #555 #f63 #999;
list-style-type: none;
}

#mainlist li a
{
position: relative;
width: 7em;
display: block;
margin: 0;
padding: 1px 0.4em;
border-width: 1px 1px 0 1px;
border-style: solid;
border-color: #ccc;
background-color: #eee;
color: #666;
font: normal 0.7em/120% Verdana, Arial, Helvetica, sans-serif;
text-align: center;
text-decoration: none;
}

#mainlist li a:hover
{
color: #00c;
text-decoration: underline;
background-color: #f63;
}

#mainlist li#active a
{
font-weight: bold;
background-color: #f63;
color: #fff;
border-color: #f96 #c30 #f63 #f96;
}

#mainlist li#active a:hover { color: #fff; }

#mainlist ul#submainlist
{
position: absolute;
width: 100%;
left: 0;
top: 1.25em;
height: 0.75em;
margin: 0;
padding: 0;
border-bottom: 3px solid #f63;
white-space: nowrap;
}

#mainlist ul#submainlist li
{
width: 14ex;
margin: 0;
border: 0;
}

#mainlist ul#submainlist li a
{
width: auto;
padding: 0.06em 1em 0;
border: 0;
background-color: #fff;
color: #000;
font: normal normal 0.66em/110% Verdana, Arial, sans-serif;
}

#mainlist ul#submainlist li a:hover
{
color: #00c;
text-decoration: underline;
font-weight: 400;
/* IE5/Mac disappearing item fix */
}

#mainlist ul#submainlist li#subactive a
{
background-color: #fc9;
color: #000;
}

* html > body #mainlist, * html > body #mainlist ul#submainlist
{
width: 600px;
/* IE5/Mac fixed width fix */
}

bradyj
10-02-2004, 12:16 AM
Please put your code in code brackets, when you post, the button for it is a little number sign. The reason it doesn't validate is because you cannot nest it that way, you have to nest it this way. First, you didn't close your home li, so close that, then nest it properly (within an li):


<ul id="mainlist">
<li></li>
<li></li>
<li></li>
<li id="active">
<ul id="submainlist">
<li></li>
<li id="subactive"></li>
<li></li>
</ul>
</li>
<li></li>
</ul>


See how I did that? I closed your home li, and then I put that other ul inside an li, and closed the li after the ul -- I've done that before it's :cool: -- just remember anything that lists inside lists must sit inside an li.

nickelsto
10-02-2004, 12:28 AM
yeah, I thought those code tags were for that but I wasn't sure. I'll do that from now on.

got it on the coding, thanks, that was easy, and with a little more persistence on my part I probably would have found such basic errors.

now, another question, I want to put a little padding, or increase the margin on the bottom of the container so that there is separation between this div and the next.
can that be done with:
margin 0px 0px 0px 5px; (can't remember now, but it goes left, right, top bottom, right?) in the same div?

bradyj
10-02-2004, 12:32 AM
It's:
top right bottom left

so:


margin: 0px 5px 0px 0px;


That's for padding too:)

and, yes, you can put it on that div, or put a top margin on the one below, your preference.

ReadMe.txt
10-02-2004, 12:32 AM
its top right bottom left, but apart form that you are correct.

nickelsto
10-02-2004, 12:43 AM
Thank you, and Readme.Txt, your signature makes me feel better about asking questions that I know are all over the place, but I am too lazy to go and read about them.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum