/    Sign up×
Community /Pin to ProfileBookmark

Replicating table layout feature

I am trying to convert a table layout to a CSS Layout. There is one thing that the client wants that I don’t know is even possible in css.

The stripped down table is:

[code=html]<table>
<tr>
<td rowspan=”2″>
<h2>Big 1</h2>
<p>No matter how big this cell is the other two will always be half as high.</p>
</td>
<td>
<h2>Box 2</h2>
</p>1/2 the height of Box 1</p>
</td>
</tr>
<tr>
<td>
<h2>Box 3</h2>
</p>1/2 the height of Box 1</p>
</td>
</tr>
</table>[/code]

Is there a way to always make box 2 & 3 50% of the height of box 1.

I’m looking for both the css and html code to do this.

to post a comment
CSS

2 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelAug 22.2006 — [code=html]<!doctype html public "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title> New Document </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="" />
<meta name="Author" content="" />
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<style type="text/css">
body, html {margin:0; padding:0; border:0;} /* Re-sets IE to "zero" for these values */

</style>
</head>

<body>

<div style="width:90%; height:500px; margin:25px auto; padding:0; border:1px solid red;">
Big Box #1<br />
More text
<div style="float:right; clear:right; width:300px; height:50%; margin:0; border:1px solid green">Little Box #2</div>
<div style="float:right; clear:right; width:300px; height:50%; border:0; border:1px solid blue">Little Box #2</div>

</div>

</body>
</html>[/code]


Tweakability assured. :rolleyes: I'm sure that the text in the BIG box will want to affect the position of the two small boxes...

Possible solution though: wrap the two right-hand DIV is a float:right; DIV and then give the 'big box' a padding-right just slightly larger than than the right-hand DIV.

ergo, if the right-hand wrapper (that contains the two smaller DIVs) is 33%, give the right-phand DIVs a width of 98 or 99% (will always completely fill the 33% DIV), then give the LARGE div (left) a padding-right: of 34 or 35%. That way, the text in LARGE div content will never crowd the wrapper to the right... (not tried myself, but there are several ways to achieve this goal that you want).
Copy linkTweet thisAlerts:
@jw_developerauthorAug 22.2006 — I'm using a liquid layout. Is there any way to do this while setting either a % height for the big box or not setting a height at all and letting the amount of content dtermine the height.

Also, your example breaks in FF. The second Little Box extends below the border of the Big Box.
×

Success!

Help @jw_developer 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.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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