Web Hosting Talk







View Full Version : Help with HTML <ul> alignment issues...


croakingtoad
11-20-2003, 08:23 PM
Take a look at : http://www.lewisgaleclinic.com/skunkworks/ingoodhealth.php

Notice the bullets in the right column how they're not aligning, they're wrapping under the bullet and strangely indenting too.

Here's the code:


<p align="left" style="font-size: 11px; font-weight: bold;">
<ul>
<li><a href="./igh_w03_heartofthematter.php">Heart of the Matter</a>
<li><a href="./igh_w03_migraines.php">Managing Migraines</a>
<li><a href="./igh_w03_shoulder_surgery.php">Shoulder Surgery Simplified</a>
<li><a href="./igh_w03_miniknee_replacement.php">Mini-Knee Replacement</a>
<li><a href="./igh_w03_fatepidemic.php">Fighting the Fat Epidemic</a>
</ul>
</p>


I have <ul> defined in my stylesheet as:

ul { display: inline; list-style: disc outside; }

Kriptonic
11-20-2003, 08:28 PM
I would be led to beleive it was because you have it in a paragraph tag. Turn that paragraph tag into a div tag and see if that doesn't fix your problem.

croakingtoad
11-20-2003, 09:57 PM
Well, I tried that and it didn't change any thing.

I feel kind of stupid, this would seem to be a simple HTML issue but I for the life of me can't figure it out ... :dunce:

bedlam
11-20-2003, 10:02 PM
Originally posted by Kriptonic
I would be led to beleive it was because you have it in a paragraph tag. Turn that paragraph tag into a div tag and see if that doesn't fix your problem.

That's right. Have a look here:

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.lewisgaleclinic.com%2Fskunkworks%2Fingoodhealth.php

The reason is this : html 4.01 transitional (which is the doctype you've specified) allows unclosed tags, so <p> without </p> is ok. But since <ul> can't go inside a <p>, the validator (& likely the browser) assumes that the paragraph that you think [i]contains the list has ended as soon as it sees the <ul> tag.

Then it runs into a </p> tag and doesn't know what to do with it. This causes the validator to flunk the page and causes the browser to get confused and show the errors that you're getting...


B

bedlam
11-20-2003, 10:07 PM
Aha - it's your stylesheet then:
ul { display: inline; list-style: disc outside; }should be either ul { list-style: disc outside; } or ul { display: block; list-style: disc outside; }

In the context you're using the list, I think it makes no sense to try to make it an inline element.

B

croakingtoad
11-20-2003, 10:12 PM
Bingo, that was it, I used your second stylesheet example.

Thanks!

bedlam
11-20-2003, 10:52 PM
np :)

Burhan
11-21-2003, 05:57 AM
Few more things :

You never close your <li> tags
You have nested block level tags (<p> and <ul>)

HPDavid
11-21-2003, 12:06 PM
good advice fyre, you just solved an issure I was having right now!! :)
Super thank-you! you don't understand how fustrated I was.