Created
December 6, 2010 21:45
-
-
Save dgmike/731025 to your computer and use it in GitHub Desktop.
Alinhando uma div verticalmente. Baseado no código do CSSplay
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
| <head> | |
| <title> Stu Nicholls | CSSplay | Centering an image using CSS</title> | |
| <style type="text/css"> | |
| /* for non-IE browsers */ | |
| div.holder {width:748px; height:300px; background:#f8f8f8; border:1px solid #777; text-align:center; display:table-cell; vertical-align:middle;} | |
| div.holder img {margin:0 auto; border:1px solid #aaa;} | |
| </style> | |
| <!--[if lte IE 7]> | |
| <style type="text/css"> | |
| /* vertical align for IE6 and IE7*/ | |
| div.holder {text-align:left;} | |
| #edge {width:0; height:100%; display:inline-block; vertical-align:middle;} | |
| #container {text-align:center; width:100%; display:inline-block; vertical-align:middle;} | |
| </style> | |
| <![endif]--> | |
| <body id="www-cssplay-co-uk"> | |
| <div id="info"> | |
| <div class="holder"> | |
| <span id="edge"></span> | |
| <span id="container"><img src="graphics/homework.jpg" alt="Homework" title="Homework" /></span> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment