Jump to content

stretching div height to height of the content


malibujamba
 Share

Recommended Posts

Hello,I would like to automaticly stretch this div to the heigth of the text. I thougt 100% would do the tricky but I was wrong. Any one can put me on the right track?example(edit: it's about the div named 'content')here is the css:

#container{	position: relative;	margin: 0;	padding: 0;	margin: 0 auto 0 auto;	width: 750px;	height: 1770px;	background-color: #735C41;}#header{	position: absolute;	margin-top: 10px;	margin-left: 10px;	width: 730px;	height: 190px;	background-color: #302215;}#header img {	border-style: none;}#content{	position: absolute;	margin-top: 210px;	margin-left: 10px;	width: 460px;	height: 1400px;	background-color: #302215;}#subcontent{	position: absolute;	margin-top: 210px;	margin-left: 480px;	width: 260px;	height: 400px;	background-color: #302215;}#subcontent img{	border-style: none;	margin-left: 5px;	margin-top: 5px;}#subcontent a {	color: #FFF0A5;	font-style: normal;}#menu{	margin-left: 10px;}#footer{	position: absolute;	margin-top: 1620px;	margin-left: 10px;	width: 730px;	height: 140px;	background-color: #302215;}

Link to comment
Share on other sites

More changes would have to be made, the CSS is just not built to expand properly. You would want to remove all of the absolute positioning and do something a bit more like this (NOTE: untested in multiple browsers, only Firefox):

#container{	margin: 0;	padding: 0 0 10px 0;	margin: 0 auto 0 auto;	width: 750px;	background-color: #735C41;}#header{	margin-top: 10px;	margin-left: 10px;	width: 730px;	height: 190px;	background-color: #302215;}#header img {	border-style: none;}#content{		margin: 10px;		float: left;	width: 460px;	background-color: #302215;}#subcontent{		margin-top: 10px;	margin-left: 480px;	width: 260px;	background-color: #302215;}#subcontent img{	border-style: none;	margin-left: 5px;	margin-top: 5px;}#subcontent a {	color: #FFF0A5;	font-style: normal;}#menu{	margin-left: 10px;}#footer{		clear: both;	margin: 10px;		padding: 20px;	background-color: #302215;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...