Click to See Complete Forum and Search --> : CSS and layers


sjefjans
09-29-2003, 11:30 AM
Hallo there,
I created a layer with Dreamweaver. It looks like:

<div id="pLayer" style="position:absolute; width:400px; height:15px; z-index:1; background-color:#E52324; layer-background-color:#E52324; color:white; border: 1px none #000000; left: 10px; top: 120px">tada</div>

Styles are set inside the div tag. Is it possible to put them in a linked stylesheet? Something like:

.pLayer
{
position:absolute;
width:400px;
height:15px;
z-index:1;
background-color:#E52324;
layer-background-color:#E52324;
color:white;
border: 1px none #000000;
}

And do the positioning attributes (left and top) stay inside the div tag, or can they also be moved to the stylesheet?


Thanks!
Sjef

pyro
09-29-2003, 11:38 AM
Yes, you can do that, and yes, you can move all style definitions (including positioning) to external styles.

sjefjans
09-29-2003, 11:41 AM
What syntax should I then use for the positioning:
top: 100px;
left: 200px;

??

pyro
09-29-2003, 11:58 AM
You can set the positioning relative to the top, right, bottom, or left. You can also specify the type of positioning as static, relative, absolute, fixed, inherit . You may be interested in http://www.w3.org/TR/CSS2/visuren.html#positioning-scheme