Log In · Register

 
browser div problems, in safari my profile is fine but everything else is off
lbroskee
post Jun 29 2008, 02:17 PM
Post #1


Senior Member
***

Group: Member
Posts: 50
Joined: Aug 2007
Member No: 555,108



in firefox 3 of the areas shift down for some reason


TEST PAGE...ok i fixed this (i think, tell me)


real page, way off, no clue y
must b under 18 to see real due to my mom being nosy. lol


BTW both pages have the same coding

if u want to see the coding and can fix that plz let me know
 
 
Start new topic
Replies
fixtatik
post Jun 29 2008, 10:19 PM
Post #2


Senior Member
******

Group: Member
Posts: 1,237
Joined: May 2008
Member No: 648,123



CODE
<style type="text/css">
.divname { position:absolute; top:0; left:50%; margin:150px 0 0 -400px; width:800px; }
</style>

this is kind of a condensed example. basically, what the whole thing means is that the div called "divname" is to be moved to the right 50% of the user's browser window width (from the left, hence "left:50%;"). the first number of the margin means you want the top of the div to be 150 pixels from the top of the page. the fourth number of the margin means you want the left side of the div -400 pixels from the exact center of the page (moving the left side in the left direction).

the format of it is like this: margin:TOP RIGHT BOTTOM LEFT;
it's the same idea as doing margin-top:##px; margin-right:##px;, etc., but in a shorter version.

the number of pixels you're moving to the left depends on how wide the div is that you're moving. in this example, if you want that 800-pixel-wide div to be in the exact center of the page, you'd move it to the left 400 pixels (-400px). in another situation, if you have a smaller div, say 230 pixels, and you wanted it 20 pixels to the right of the exact center, you'd simply put "20px" where the left margin number goes.

it's kind of confusing when you're first starting out, but it really just takes practice, like everything else. learn by trial and error: sometimes it's the best way.
 

Posts in this topic


Closed TopicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members: