View Full Version : turn off the bullets in a <ul> inside a <p>

05-18-2005, 08:25 PM
Hi all

i would like to turn of the bullets only if they are inside a <p>.

I tried to do like this,
P UL {list-style: none;} and it does not work.

if i use a DIV instead of <p> and use DIV UL {list-style: none;} then it works.

Could someone please help.



05-18-2005, 08:28 PM
Hmm. From a semantic point of view, why would you have a <ul> (unordered list) inside of a <p> (paragraph)?

05-18-2005, 08:33 PM
Could always make a new UL class for those only within <p> tags.

code inside the CSS would be:

inside your html:

<ul class="whatever">

05-18-2005, 08:35 PM
Carl, I didn't know why any one would use a list inside paragraph but i was asked a question how would you solve it, and was wondering if there was a way to solve it.

05-18-2005, 08:38 PM
I don't think you can use a list inside a paragraph - the validator will throw out a error I think..

05-18-2005, 08:52 PM
Have you tried targeting the li or ol tags insted? Also try using lowercase in your CSS.

p ul li {
list-style: none;

And yes I think it won't work because it is invalid code (going from memory). I think you would be better off using a div as suggested. as such you could try:

div ul {
list-style: none;
div ul li {
list-style: none;

if you still get problems.

05-18-2005, 09:16 PM
You can't have a ul inside a paragraph. That's why your selector isn't working. Paragraphs can only contain inline elements, and <ul> is block-level.