Sunday, 15 August 2010

html - How to center link button vertically and horizonally inside image banner -



html - How to center link button vertically and horizonally inside image banner -

i need center image within banner. centered horizontally , vertically.

here jsfiddle made. center of button must between vertical reddish line , centered vertically.

jsfiddle

thank you.

<table width="100%" border="0px" style="background:transparent"> <tr> <td height="305px"> <div style="text-align:center;"> <a href="#" class="botonconocer" >conocer más</a> </div> <img src="img/grass.jpg" style="width:100%;height:305px" class="img-responsive" /> </td> </tr> </table>

if button positioned absolute in css, can add together style create show in middle

.botonconocer { top: 50%; left: 50%; margin: -28px 0 0 -82px; }

in margin set negative number equal half height , half width, show in middle position it's relative to, if want create appear in middle of container, should add together container

.container {position: relative}

here's results in jsfiddle

html css alignment center

No comments:

Post a Comment