Forum Moderators: not2easy
i have the following HTML....
<div position="absolute" top="10" left="12"></div>
<div position="absolute" top="10" left="30"></div>
<div position="absolute" top="10" left="40"></div>
<div position="absolute" top="10" left="60"></div>
can we combine the position into one in CSS?
DIV{position="absolute"}......(something like these?)
and the positioning on the window is still remain the same?
Yes you can do that, but if you use
div{position:absolute;}
all of the divs in the page will use absolute positioning, unless you specify otherwise.
My advice would be to use something like:
.abs{position:absolute;}
and then just attach the class to the div like so:
<div class="abs" top="10px" left"12px"> etc...
you can also add the top:10px to the class in css and then you don't need to add that to every div.
In the end, you should create a class for every div in your css and just attach the classes to the divs. It just makes more sense if you're gonna use css in any case.
Hope you find this helpfull
Cor
This :
<div position="absolute" top="10" left="12"></div>
<div position="absolute" top="10" left="30"></div>
<div position="absolute" top="10" left="40"></div>
<div position="absolute" top="10" left="60"></div>
Something similar to this might look like this :
<div class="abs" id="a"></div>
<div class="abs" id="b"></div>
<div class="abs" id="c"></div>
<div class="abs" id="d"></div>
.abs {position:absolute; top:10px;}
#a {left:12px;}
#b {left:20px;}
#c {left:40px;}
#d {left:60px;}
However, I suspect that there is a better way to do what you want to do (though it would help if I knew exactly what you were trying to do).
Could you possibly post some more code and explain what you're after?