473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Help expanding elements to their containers' size (but with margin)

thescripts gurus,

I would like to know if I could get some help with making elements of my layout expand (liquid) to the size of their containers, but also allow for some predefined, static margin/spacing. The layout is table-based, only because it needs to be very modular (going into more of an app than a website, and being reused) and needs to accommodate content of various sizes. Although I suppose i could mimic this with min-height styles on a div.

Below is my HTML + CSS code. As you can see it currently does not expand as I would like it to; I'd like to see the "pods" (tables of class "pod") expand to fill their containers. If I do set height/width: 100%, the "pods" will grow too large since their actual size will be greater than 100% including margins, in the standard box model. Also, just to be specific, I would like to keep the headers of the 'pods' to their static height if at all possible, and not let those be liquid, but only for their content (cell class "content") to expand.

Hopefully someone here has a solution I haven't thought of. I could resort to javascript since this doesn't really need to degrade, or my other idea is to introduce forced margins via blank images or some other element, but I really would like to avoid such a hack if possible. I am definitely open to a div-based solution as well.

Thanks in advance for anyone's help!

[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>fully-expanded tables</title>
<style type="text/css">
html {
font-size: 100%;
height: 100%;
width: 100%;
}

body {
margin: 0px;
background-color: aqua;
font-family: arial;
font-size: 0.625em;
}

table#main, table#main td {
padding: 0px;
margin: 0px;
}

table#main {
width: 100%;
height: 100%;
}

td.column {
width: 33%;
}

table.pod {
padding: 0px;
margin: 6px 3px 3px 3px;
background-color: white;
/*
Here is where I would like to have
width and height expand to 100% apiece,
but this will not work with margin or padding
*/
}

.pod td.content {
/* Here I would also like things expanded */
}

div.header {
text-align: center;
font-size: 1.7em;
height: 25px;
color: white;
background-color: green;
padding: 3px;
}
</style>
</head>

<body>
<table id="main">
<tr>
<td class="column">
<table class="pod">
<tr>
<td><div class="header">TITLE 1</div></td>
</tr>
<tr>
<td class="content">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse enim. Ut ultrices. Curabitur varius nisl vitae enim. Nullam vel dolor. Donec nibh. Integer varius ipsum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque suscipit. Suspendisse pellentesque tincidunt ligula. Vestibulum bibendum mattis ligula. Quisque et lectus. Vestibulum adipiscing pretium tellus. Donec ut lacus eu nisl pulvinar imperdiet. Sed elit nibh.
</td>
</tr>
</table>
</td>
<td class="column">
<table class="pod">
<tr>
<td><div class="header">TITLE 2</div></td>
</tr>
<tr>
<td class="content">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris nisl lorem, tincidunt id, ultricies at, consectetuer non, enim. Nam dolor. Maecenas vehicula congue ligula. Nam et quam. Maecenas et turpis.
</td>
</tr>
</table>
</td>
<td class="column">
<table class="pod">
<tr>
<td><div class="header">TITLE 3</div></td>
</tr>
<tr>
<td class="content">
Lorem ipsum dolor sit amet.
</td>
</tr>
</table>
</td>
</tr>
</table>

</body>
</html>[/HTML]
Jan 31 '08 #1
1 2055
harshmaul
490 Expert 256MB
Hi,

Sorry this is quite late, but i'm just diggin through some old threads...

Expand|Select|Wrap|Line Numbers
  1. .pod{
  2. height:95%;
  3. vertical-align:top;
  4. }
this css will make the "pods" heights fit the table almost fully.

the trick is to use percents, and make sure that the hieghts and padding adds up to 100. eg.. 5% padding top and bottom = 10% total. + 90% height = 100%.
Feb 11 '08 #2

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

Similar topics

14
by: Jinjun Xu | last post by:
Hi, I have an array and I want to adjust the size (remove some elements). I use the following code. Can you help me to check whether it's correct. ////////////// start int *p1 = new int; ...
1
by: danxavier | last post by:
I successfuly installed dd.php and sajax.php files. It runs fine, but I would like to link the $items to an image. I called the field in mysql with the link "pic". Any help would be AWESOME!!! I've...
7
by: webgyrl | last post by:
Hi, I am helping a musician friend of mine with his profile and I found a cool layout on Nas' MySpace page. I changed some things and re-did the graphics and I basically popped my Image URLS...
3
by: charchap | last post by:
hello. I'm experiencing problems with my css code (once again) working with Firefox and not working with IE 6 or 7 I have a problem with my head_logo_inner not too sure what's going on . Here is...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
1
by: Miked | last post by:
Hello: I'm relatively new to CSS, and I'm doing a site where I don't want to use any tables. I've gotten pretty far, and the site has the layout I want. My only problem is that I'm using the...
1
by: kidelectric | last post by:
The issue I am having is that I would like to be able to drag-and-drop div elements that have rounded corners.* Since these elements will be dynamically created (including background color), I could...
0
by: magicofureyes | last post by:
Hello Guys im a just a new user and i dnt knw much abt Xml i want to upload a new template in Blogger so got some free coding but when i save this code in Blogger template it say '''' Your...
1
by: jeddiki | last post by:
Hello, I have made a nice opt-in form and tested it in Moz FF and it looks fine. But in IE the elements don't line up properly. I think I am nearly there but can not get these elements...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.