/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] help framing a table with 4 divs

okay, im licked. ive been trying to get a table to sit in the center of 4 divs that “frame” it.

[code]<!DOCTYPE html
PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />
<title></title>
</head>
<body style=”height: 100%”>

<div id=”outside” style=”border: 1px dashed black; width: 95%; background-color: gray; margin-left: auto; margin-right: auto;”>
<div id=”top” style=”border: 1px solid yellow; background-color: red; height: 5px;”></div>
<div id=”left” style=”border: 1px solid orange; background-color: red; width: 5px; height: 100% float: left”></div>
<div id=”right” style=”border: 1px solid orange; background-color: red; width: 5px; float: right”></div>
<div style=”display: inline; width: 100%”>
<table cellpadding=”0″ cellspacing=”1″ border=”0″ width=”100%” style=”background-color: green”>
<tbody>
<tr>
<td style=”background-color: lightgreen”>cell information</td>
</tr>
<tr>
<td style=”background-color: lightgreen”>cell information</td>
</tr>
<tr>
<td style=”background-color: lightgreen”>cell information</td>
</tr>
<tr>
<td style=”background-color: lightgreen”>cell information</td>
</tr>
</tbody>
</table>
</div>
<div id=”bottom” style=”border: 1px solid yellow; background-color: red; height: 5px;”></div>
</div>

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

that code gets me close, but the left and right divs just arent playing right. i cant get them to be a hieight of 100%, and to get them to force the table to sit between them.

any help? ive included a picture if the description above doesnt help

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@cootheadFeb 15.2009 — Hi there aaron.martinas,

you will never get it to work like that. :eek:

Have a look at this example, it may suit your requirements, well almost. ?

[color=navy]
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;

&lt;title&gt;&lt;/title&gt;

&lt;style type="text/css"&gt;
#outside {
width: 95%;
margin:auto;
border:1px dashed #000;
}
#inner {
padding:5px;
border:2px solid #ff0;
background-color:#f00;
}
#table1 {
width:100%;
border:2px solid #ff0;
background-color:#008000;
}
#table1 td {
background-color:#90ee90;
}
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div id="outside"&gt;
&lt;div id="inner"&gt;

&lt;table id="table1" cellpadding="0" cellspacing="1"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;cell information&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt;cell information&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt;cell information&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt;cell information&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
[/color]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@Angry_Black_ManauthorFeb 15.2009 — the framing was because i need to use custom backgrounds in each of the four "frame" divs, and because the height of the whole thing is variable, so it would be a repeating background

thanks for the attempt!
Copy linkTweet thisAlerts:
@cootheadFeb 15.2009 — Hi there aaron,
[color=navy]the framing was because I need to use custom backgrounds in each of the four "frame" divs[/color][/quote]
Well, you did not mention that in your original post, you naughty boy. ?

If I had been aware of that requirement, I would have offered you this example for your consideration...
[color=navy]
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;

&lt;base href="http://www.coothead.co.uk/images/"&gt;

&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;

&lt;title&gt;&lt;/title&gt;

&lt;style type="text/css"&gt;
#outside {
width:95%;
margin:auto;
border:1px dashed #000;
}
#top {
height:10px;
margin:5px 5px 0;
background-image:url(anim4.gif);
border:1px solid #008000;
font-size:0; /* this is required by IE 6 */ <br/>
}
#inner_left {
margin-left:5px;
padding-left:10px;
border-left:1px solid #008000;
background-image:url(anim1.gif);
background-repeat:repeat-y;
}
#inner_right {
margin-right:5px;
padding-right:10px;
border-right:1px solid #008000;
background-image:url(anim2.gif);
background-repeat:repeat-y;
background-position:right top;
}
#table1 {
width:100%;
border-right:1px solid #008000;
border-left:1px solid #008000;
border-collapse:collapse;
}
#table1 td {
background-color:#90ee90;
border-bottom:1px solid #008000;
}
#table1 #no_border {
border-bottom:0;
}
#bottom {
height:10px;
margin:0 5px 5px;
border:1px solid #008000;
background-image:url(anim5.gif);
font-size:0; /* this is required by IE 6 */
}
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div id="outside"&gt;

&lt;div id="top"&gt;&lt;/div&gt;

&lt;div id="inner_left"&gt;

&lt;div id="inner_right"&gt;

&lt;table id="table1"&gt;&lt;tbody&gt;&lt;tr&gt;

&lt;td&gt;cell information&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt;cell information&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt;cell information&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td id="no_border"&gt;cell information&lt;/td&gt;

&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;

&lt;/div&gt;&lt;!-- end #inner_right --&gt;

&lt;/div&gt;&lt;!-- end #inner_left --&gt;

&lt;div id="bottom"&gt;&lt;/div&gt;

&lt;/div&gt;&lt;!-- end #outside --&gt;

&lt;/body&gt;
&lt;/html&gt;
[/color]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@Angry_Black_ManauthorFeb 15.2009 — wow, that's BEAUTIFUL!

...you did not mention that in your original post...[/QUOTE]

kinda, but the idea i presented required 4 divs framing the table ? but it's of no consequence now! thanks!!
Copy linkTweet thisAlerts:
@cootheadFeb 15.2009 — [indent]No problem, you're very welcome. ?[/indent]
×

Success!

Help @Angry_Black_Man 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.16,
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,
)...