homepage Welcome to WebmasterWorld Guest from 23.23.12.202
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
CSS Table height 100% width 100%
How do I center the content horizontally and vertically?
lamf

5+ Year Member



 
Msg#: 3256657 posted 8:58 am on Feb 19, 2007 (gmt 0)

I need to make the css properties for a table with the following standard html properties:
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle><img src="logo.gif" width="567" height="379" border="0" align="middle"></td>
</tr>
</table>
Thanks for any assistance!

 

Moby_Dim

10+ Year Member



 
Msg#: 3256657 posted 4:11 pm on Feb 20, 2007 (gmt 0)

You can do this tableless. Try something like this :

<body style="width : 100%; height : 100%; margin : 0; padding : 0;">
<img src="logo.gif" width="567" height="379" alt="This is my LOGO!" border="0" style="width : 567px; height : 379px; margin-top : -190px; margin-left : -284px; position : absolute; top : 50%; left : 50%;">
</body>

did not test this but should work imho.

[edited by: Moby_Dim at 4:14 pm (utc) on Feb. 20, 2007]

[edited by: SuzyUK at 4:35 pm (utc) on Feb. 20, 2007]
[edit reason] removed smiley from code [/edit]

Moby_Dim

10+ Year Member



 
Msg#: 3256657 posted 4:12 pm on Feb 20, 2007 (gmt 0)

and Welcome to WebmasterWorld ;)

cmarshall

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 3256657 posted 4:35 pm on Feb 20, 2007 (gmt 0)

I tested it with the following, and it works on every browser except Mac IE.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Test</title>
<style type="text/css">
/* <![CDATA[ */
body
{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}

div.centerer
{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}

img.centered
{
margin: 0;
padding: 0;
width: 320px;
height: 155px;
margin-left: -160px;
margin-top: -77px;
position: absolute;
top: 50%;
left: 50%;
}
/* ]]> */
</style>
</head>
<body>
<div class="centerer">
<img class="centered" src="images/DSC_1200.JPG" />
</div>
</body>
</html>


Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved