/    Sign up×
Community /Pin to ProfileBookmark

Vertical Align problem

Hi,

Could somebody help me with this simple task?

I want the red box to fill the whole page (ie 100% width & height) and the blue box to to be centered (horizontally & vertically)

[url]http://www.adjectivenoun.co.uk/TEST-NEW.html[/url]

Here’s my coding:

[CODE]
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<title>TEST NEW</title>
<style type=”text/css”>
<!–
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
–>
</style></head>

<body>
<table width=”100%” height=”100%” border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td height=”867″ align=”center” valign=”middle” bgcolor=”#FF0000″><table width=”1020″ height=”602″ border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td bgcolor=”#0000FF”>&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
[/CODE]

Please help me out. I’ve been banging my head against the wall all day.

thanks,
Rich ?

to post a comment
HTML

1 Comments(s)

Copy linkTweet thisAlerts:
@kaurotuJan 03.2009 — I checked the code, and it seems to be working. (basically)

The blue box is centered, but I have to scroll down to see the bottom. Is this the effect that you want? I noticed the height and width of the blue box is a constant set in the code. Do you want it to be more dynamic?

Although, if you want to use CSS (my recommendation), do a google search for "css vertical center". I'm sure plenty of results will show up.
×

Success!

Help @rediffusion spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...