Click to See Complete Forum and Search --> : Positioning text on the screen exactly with css
Mythic Fr0st
12-23-2006, 02:46 AM
Ok, im trying to position text on the screen exactly where I want
I have about 20 different things placed on the screen
using <div style='position: absolute; top: x; left: y;'>
and i've been told to change that by a friend...
So im looking for a way to do the same thing purely in css
however, my text is not, and CAN NOT be grouped all in one, so using something like
p {
top:30px
left:25px
}
or w/e it is, wont work
Can anyone tell me what to use o_O?
Weedpacket
12-23-2006, 07:07 AM
Er, "style='position: absolute; top: x; left: y;'" is purely CSS (assuming x and y are units, like "30px" and "25px").
I think you'll need to explain what it is you're after in a little more detail.
rincewind456
12-23-2006, 07:14 AM
You may want your friend to explain what he means by purely CSS!
What you are doing with style='position: absolute; top: x; left: y;' is CSS.
What you could/should do if you have more than one page is have your CSS in an external style sheet. So by assigning a class name to the div like <div class="boxA"> and then in your external sheet you would have the boxA {position:absolute;top: x; left: y;}
Mythic Fr0st
12-23-2006, 07:18 AM
I said I was trying to do it 'purely' css:P not him, he just said tutorial lol...
btw
<div style='position: absolute; top: 300; left: 300;'> there coordinates, not px
so
<div class="mhd"> all my html tables, text, PHP scripts and so on that I want here</div>
mhd {position:absolute;left:30px;top:20px;}
?
and that will position it there?
Weedpacket
12-23-2006, 09:32 AM
<div style='position: absolute; top: 300; left: 300;'> there coordinates, not pxWell that's invalid; all units must be stated (http://www.w3.org/TR/CSS1#length-units) (the only case when it isn't necessary is when the value is 0). How is the client supposed to know which units you want if you don't say? Pixels (px)? Points (pt)? Ems (em)? Millimetres (mm)?
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.