By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,447 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,447 IT Pros & Developers. It's quick & easy.

Center Image in page

hsriat
Expert 100+
P: 1,654
How can i render an image in the center of a page.

I did this: [html]<table width="100%" heigth="100%">
<tr>
<td valign="middle" align="center"><img...... /></td>
</tr>
</table>[/html]
Mar 4 '08 #1
Share this Question
Share on Google+
4 Replies


drhowarddrfine
Expert 5K+
P: 7,435
That works for me. .
Mar 4 '08 #2

hsriat
Expert 100+
P: 1,654
That works for me. .
It does, but without any doctype.
Gives validation error with the height attribute and height doesn't become 100%.
Mar 4 '08 #3

drhowarddrfine
Expert 5K+
P: 7,435
Not sure I understand but try this:
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
html,body{height:100%;width:100%;margin:0}
table{height:100%;width:100%;}
table tr td {text-align:center}
</style>
</head>
<body>
<table border=1>
<tr>
<td><img src="1.png" alt=""></td>
</tr>
</table>

</body>
</html>[/HTML]
Mar 4 '08 #4

hsriat
Expert 100+
P: 1,654
Not sure I understand but try this:
[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
html,body{height:100%;width:100%;margin:0}
table{height:100%;width:100%;}
table tr td {text-align:center}
</style>
</head>
<body>
<table border=1>
<tr>
<td><img src="1.png" alt=""></td>
</tr>
</table>

</body>
</html>[/HTML]
Yeah that works.

Thanks...
Mar 4 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.