Created
October 29, 2009 02:58
-
-
Save rajeshg/221076 to your computer and use it in GitHub Desktop.
This file contains 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
<html> | |
<head> | |
<style type="text/css"> | |
div#centered { | |
position: absolute; | |
} | |
</style> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> | |
</script> | |
<script type='text/javascript'> | |
$(document).ready(function(){ | |
var height = $('#centered').height(); | |
var width = $('#centered').width(); | |
var docheight = $(document).height(); | |
var docwidth = $(document).width(); | |
var top = (docheight - height)/2; | |
var left = (docwidth - width)/2; | |
$('#centered').css('top', top+'px'); | |
$('#centered').css('left', left+'px'); | |
}); | |
</script> | |
</head> | |
<body> | |
akjdakfjdkf | |
<div id="centered"> | |
<p>Paragraph 1 text.</p> | |
<p>Paragraph 2 text.</p> | |
</div> | |
kadjkfjadkf | |
kajfkadjf | |
<div> | |
akjfkdajfk | |
</div> | |
<p>ajdfkdjaf kajfkdajf .jkjakdjfakdjf. | |
kadjfkadjfka. | |
kdjfkajdfkdajf kajdfkadjf kjfkajdfka. </p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment