I just wanna center a div!
I just wanna center a div!
Out of context: Reply #35
- Started
- Last post
- 39 Responses
- wckd0
DIV.epic {
float: left;
background: url('bg.gif');
display: block;
width: 210px;
height: 120px;
margin: 5px;
position:relative;
}
DIV.epic IMG {
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
margin:auto;
}no?
- this will not center vertically and horizontallydbloc
- right you are, only checked ffwckd
- yup, this works in safari , ff and chrome.
working link: http://balas.me/stuf…ESKEMA - this is only centering 100% horizontally. It is fixed vertically.dbloc
- no, it is centering both vertically and horizontally.
http://balas.me/stuf…ESKEMA - at least on my end...ESKEMA
- not working for me in any browser..are you on PC by chance?dbloc
- Mac Lion, works here in safari 5.1.2, FF 4.0.1 and latest Chrome.ESKEMA