5 replies [Last post]
mb1
mb1's picture
User offline. Last seen 1 year 23 weeks ago. Offline
newbie
Timezone: GMT+2
Joined: 2010-08-21
Posts: 4
Points: 5

hi,

how to make divs stretch 100% in height?

<!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" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>My page title</title>
</head>
<body>
 
<div style="width:600px; height:150px; background-color:red;">TOP</div>
<div style="width:600px; background-color:yellow;">MIDDLE</div>
<div style="width:600px; height:20px; background-color:blue;">BOTTOM</div>
 
</body>
</html> 

Verschwindende
Verschwindende's picture
User offline. Last seen 6 days 3 hours ago. Offline
rank Guru
Guru
Timezone: GMT-5
Joined: 2009-10-09
Posts: 2037
Points: 2256

Vertical columns: Faux

Vertical columns: Faux columns.
Horizontal rows: Sticky footer.

Judging from the names of the divs you want "sticky footer".

yet again.

mb1
mb1's picture
User offline. Last seen 1 year 23 weeks ago. Offline
newbie
Timezone: GMT+2
Joined: 2010-08-21
Posts: 4
Points: 5

I think neither is helping

I think neither is helping here.

I have a new code and problem is that #container does not wrap the inner div (#test). Can it be done somehow? Without Javascript, without background image, only CSS?

<!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" lang="en" xml:lang="en">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>	
 <title>My page title</title>
 
<style type="text/css">
html {
height: 100%;
}
 
body {
background-color: black;
margin: 0px 0px 0px 0px;
height: 100%;
}
 
#container {
background-color: green;
width: 900px;
height: 100%;
margin: 0px auto;
border-left: 5px solid yellow;
border-right: 5px solid yellow;
}
 
#test {
height: 900px;
width: 200px;
float: left;
background-color: orange;
}
</style>
 
</head>
<body>
 
<div id="container">
 
	<div id="test"></div>
 
</div>
 
 
</body>
</html>

Verschwindende
Verschwindende's picture
User offline. Last seen 6 days 3 hours ago. Offline
rank Guru
Guru
Timezone: GMT-5
Joined: 2009-10-09
Posts: 2037
Points: 2256

Personally, I'd use Faux

Personally, I'd use Faux Columns and call it a day. Your second question could possibly be solved by clearing (or containing) your floats.

yet again.

mb1
mb1's picture
User offline. Last seen 1 year 23 weeks ago. Offline
newbie
Timezone: GMT+2
Joined: 2010-08-21
Posts: 4
Points: 5

Or is there any

Or are there any alternatives?

This is what i would like to have in the center, #container, 900px width, with left and right border:

And after that i would like to add divs inside #container.

mb1
mb1's picture
User offline. Last seen 1 year 23 weeks ago. Offline
newbie
Timezone: GMT+2
Joined: 2010-08-21
Posts: 4
Points: 5

Verschwindende

Verschwindende wrote:

Personally, I'd use Faux Columns and call it a day. Your second question could possibly be solved by clearing (or containing) your floats.

When i used background image (Faux Columns) some browsers didn't show website very good.
Adding another div below with clear:both; does not work - #container still does not wrap inner divs:

Can it be done by using some combination of tables and CSS?