...

View Full Version : CSS Variables?



student101
10-31-2009, 12:32 PM
Is it possible to do variables in CSS that will automatically find and work with the different divs?
Example;


#corner1,#corner2,#corner3,#corner4,#corner5 {
width:650px;
padding:0px;
border: 1px solid #999999;
margin-right: auto;
margin-left: auto;
margin-top: 50px;
}
#corner"all numbers" p {
padding: 5px;
}


Standard method;
Example;


p {
padding: 5px;
}
#corner1,#corner2,#corner3,#corner4,#corner5 {
width:650px;
padding:0px;
border: 1px solid #999999;
margin-right: auto;
margin-left: auto;
margin-top: 50px;
}

effpeetee
10-31-2009, 01:33 PM
I asked this question once here. The answer was No! Not if you mean a variable that can have a value assigned to it to be used in a calculation.

This is OK. Assigning the same css to more that one Div name. That is OK.


#corner1,#corner2,#corner3,#corner4,#corner5 {
width:650px;
padding:0px;
border: 1px solid #999999;
margin-right: auto;
margin-left: auto;
margin-top: 50px;
}

This second part is not valid.


#corner"all numbers" p {
padding: 5px;
}





Frank

student101
10-31-2009, 01:38 PM
I've seen some neat CSS tricks on quirks mode.
Ok cool no vars in CSS.

abduraooft
10-31-2009, 02:19 PM
Can't you just wrap them inside a container and use a specific selector, say

#myelements div{
/* all style goes here */
}

<div id="myelements">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
Or set a class on all divs and use an appropriate selector.

student101
10-31-2009, 04:03 PM
that could work, just wanted to find out about variables and if possible.
Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum