[thelist] CSS question (Martin? Rudy?)

Martin Burns martin at easyweb.co.uk
Fri Jun 7 20:56:01 CDT 2002


On Friday, June 7, 2002, at 01:45  am, Techwatcher wrote:

> Anyway, my question is this: It's my very first totally CSS-controlled
> site, and I want to be able to use the fixed position box. I know my
> next CSS spec pages to plow through are inheritance & cascading, but
> for what element (or classes?) can I assign large margin values, but
> set to 0 left-margin for the part of the page where I want the nav
> list? I was hoping to set large margins for body, but reset them for
> H1, and that didn't work. When I finally had access to a CSS-capable
> browser (my development machine has an ancient browser), it turned out
> I had to add in CSS rules for all the elements individually (UL, P,
> etc.).

I guess you're doing something like
body {left-margin: 10px;}
h1 {left-margin: 0;}
#nav {left-margin: -10px;}

or
body {left-margin: 0px;}
h1 {left-margin: 10;}
#nav {left-margin: 0px;}

2 other approaches for you:
1) You can set rules on multiple elements at once:
h1, p, ul {left-margin: 10;}

2) Try this:
body {left-margin: 0px;}
#main {left-margin: 10px;}
#nav {left-margin: 0px;}

where your html has:
<body>
<div id="nav">
nav stuff
</div>
<div id="main">
main body with <h1>, <p>, <ul> etc
</div>
</body>

> Also, the fixed position doesn't do what I expected (it scrolls with
> the page).

You mean it stays on the same place in the window while the content
scrolls around it? (eg sticks to the top of the window)

You want it to stay at the top of the page as if it's normal inline
content and keeps the rest of the page below it?
try position: absolute

> Any comments from the experts before I hit the "books" again?

I'm not a CSS expert - but I play one in panto.

Good book:
Cascading Style Sheets: Separating Content from Presentation:
http://www.glasshaus.com/bookInfo.asp?bookId=59

I'm working my way through it and it's helping me enormously.

Cheers
Martin
_______________________________________________
email: martin at easyweb.co.uk             PGP ID:	0xA835CCCB
	martin at members.evolt.org      snailmail:	30 Shandon Place
   tel:	+44 (0)774 063 9985				Edinburgh,
   url:	http://www.easyweb.co.uk			Scotland




More information about the thelist mailing list