Log In · Register

 
Centering DIV in different resolutions
Unfold
post Dec 25 2006, 01:52 PM
Post #1


Always Move Fast
****

Group: Member
Posts: 167
Joined: Aug 2005
Member No: 192,635



I've tried using this code to center my DIV layout in different resolutions :
CODE
<div class="content" style="position:absolute; z-index:2; left:50%; top:0%;
margin-left:-195px; margin-top:150px; width:210px; height:210px;border-style:solid; border-width:0px; border-color:000000;overflow:auto;">


but it doesn't seem to work for me.
do i need to delete the image code of my layout for it to work?
 
 
Start new topic
Replies (1 - 7)
*WHIMSICAL 0NE*
post Dec 25 2006, 02:04 PM
Post #2





Guest






It should work. Are you closing your divs?

CODE
<div class="content" style="position:relative; z-index:2; left:50%; top:0%;
margin-left:-195px; margin-top:150px; width:210px; height:210px;border-style:solid; border-width:0px; border-color:000000;overflow:auto;"> CONTENT </div>
 
Unfold
post Dec 25 2006, 02:20 PM
Post #3


Always Move Fast
****

Group: Member
Posts: 167
Joined: Aug 2005
Member No: 192,635



hmmm that's for my content right?

is there any way that i could make everything (content and DIV image) centered for every resolution?
 
*WHIMSICAL 0NE*
post Dec 25 2006, 02:52 PM
Post #4





Guest






Hm, you could make seperate divs for the image and the content so that the image doesn't interfere with the content. So if you wanted your image centered you could just do this:
CODE
<div class="image" style="position: absolute; left:center; top:150px; background-color:;"><img src="http://IMGURL"></div>


It should horizontally center it, but you need to bring it down from the top so it doesn't cover up the ad.
 
Unfold
post Dec 25 2006, 02:58 PM
Post #5


Always Move Fast
****

Group: Member
Posts: 167
Joined: Aug 2005
Member No: 192,635



thanks a lot! :)
 
Unfold
post Dec 25 2006, 07:15 PM
Post #6


Always Move Fast
****

Group: Member
Posts: 167
Joined: Aug 2005
Member No: 192,635



it seems that it still not centering though im using this code:

CODE
<div class="image" style="position: absolute; left:centerpx; top:180px; background-color:;"><img src="http://i10.tinypic.com/2ljowvs.jpg"></div>




here's my test site for my layout click!
 
*Infinite.*
post Dec 25 2006, 08:08 PM
Post #7





Guest






you can try this:

<div class="image" style="position: absolute; left:25%; top:180px; background-color:;"><img src="http://i10.tinypic.com/2ljowvs.jpg"></div>
 
annalucky
post Dec 26 2006, 03:32 AM
Post #8


Lurker.
******

Group: Official Designer
Posts: 2,161
Joined: Feb 2004
Member No: 3,851



QUOTE(GEEK iN THE PiNK @ Dec 25 2006, 7:15 PM) *
it seems that it still not centering though im using this code:

CODE
<div class="image" style="position: absolute; left:centerpx; top:180px; background-color:;"><img src="http://i10.tinypic.com/2ljowvs.jpg"></div>

here's my test site for my layout click!



You should take out the "px" in "centerpx." =]
 

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