A Little Something About Me

My name's Khoa, I'm a freelance designer, Photographer. I run my Medizai.com and I specialize in Design, Joomla, CSS, XHTML and PHP

Want to hide me? See my CV here

Navigation

Social Stuff

About
Thủ thuật đơn giản để canh giữa ảnh PDF Print E-mail
Monday, 11 July 2011 08:39

 

 

Một vài thủ thuật đơn giản để cho ảnh được canh giữa.


Kỹ Thuật CSS background-image:

html {
   width
:100%;
   height
:100%;
   background
:url(logo.png) center center no-repeat;
}

Kỹ Thuật CSS + Inline Image :

img {
   position
: absolute;
   top
: 50%;
   left
: 50%;
   width
: 500px;
   height
: 500px;
   margin
-top: -250px; /* Half the height */
   margin
-left: -250px; /* Half the width */
}

Kỹ Thuật Table:

html, body, #wrapper {
   height
:100%;
   width
: 100%;
   margin
: 0;
   padding
: 0;
   border
: 0;
}
#wrapper td {
   vertical
-align: middle;
   text
-align: center;
}
<html>
<body>
   
<table id="wrapper">
     
<tr>
         
<td><img src="logo.png" alt="" /></td>
     
</tr>
   
</table>
</body>
</html>

 

 

Add comment

Hi there! you can put your comment here.

Security code
Refresh