f



CSS for All Elements (Bullets <UL> <LI>) Without <DIV ID="">

Hello!

I have a quick question regarding CSS and having it applied to all
elements.  I am trying to eliminate the gap between a paragraph and a
list that usually occurs in html and I've found away to do that with
this code:

<p>a</p>
<ul style="margin-top: -20; padding-top: 0">
  <li>1</li>
</ul>

However I was hoping to use CSS to do it to all elements and without
using <DIV id="">.  Here is an example of the CSS code I have so far,
but you need to use <div id="squish"> around them.

<style type="text/css">
#squish {
	width: 10em;
	}
	#squish ul {
		margin-left: 1em;
		margin-top: -20;
		padding-top: 0;
		padding-left: 0;
		}
</style>

Is there a way to apply this to all bullets <UL> <LI> on the page
using CSS without having to use <div id="">?

Thanks for your help!

Shaun
0
smacpher
2/22/2005 7:17:12 PM
comp.authoring.html 7078 articles. 0 followers. Post Follow

2 Replies
514 Views

Similar Articles

[PageSpeed] 53

in comp.infosystems.www.authoring.html, Shaun wrote:
> Hello!
> 
> I have a quick question regarding CSS and having it applied to all
> elements. 

Then why are you asking here? alt.html where you asked first is good also 
for CSS, but this group is only for HTML. There is 
comp.infosystems.www.authoring.stylesheets for CSS.

> I am trying to eliminate the gap between a paragraph and a
> list that usually occurs in html and I've found away to do that with
> this code:
> 
> <p>a</p>
> <ul style="margin-top: -20; padding-top: 0">
>   <li>1</li>
> </ul>

Which is wrong, as pointed out for you in alt.html

> However I was hoping to use CSS to do it to all elements and without
> using <DIV id="">. 

Then why are you using div with id?

> Here is an example of the CSS code I have so far,
> but you need to use <div id="squish"> around them.
[snip]

Go look for selectors in CSS

> Is there a way to apply this to all bullets <UL> <LI> on the page
> using CSS without having to use <div id="">?

Most likely, but I fail to understand your question.

ul {background:red;}   



-- 
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
0
Lauri
2/22/2005 7:20:31 PM
Shaun wrote:
> Hello!
> 
>   I am trying to eliminate the gap between a paragraph and a
> list .....

I guess that you have to understand that P and LISTS are blocks and that 
blocks provide double 'line leading/breaks/line returns' as a 
conventional default. This is done by the browser with a default 
margin-bottom and margin-top. (The double line leadings for both are 
collapsed to only one double line leading.)

In order to eliminate the double line leading, the margin-bottom for the 
preceding Paragraph must be set to zero and the margin-top for the 
subsequent List must be set to zero.

-- 
Gus
0
Gus
2/23/2005 3:50:43 AM
Reply: