ben03 Posted February 10, 2009 Share Posted February 10, 2009 I am trying to create a main container DIV box to hold all contents of the site. The problem I'm facing is the DIV won't colour (background-color) unless i specify a height - which varies per page.Does this mean I have to specify a seperate container DIV for each page to suit the various heights so that a colour will render or is there a way round this?Thanks Link to comment Share on other sites More sharing options...
Jerry62704 Posted February 10, 2009 Share Posted February 10, 2009 I am trying to create a main container DIV box to hold all contents of the site. The problem I'm facing is the DIV won't colour (background-color) unless i specify a height - which varies per page.Does this mean I have to specify a seperate container DIV for each page to suit the various heights so that a colour will render or is there a way round this?ThanksThis produces no pink. Add "height:100%;" to the css and it produces one line of pink.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Home</title><style type="text/css">* {margin:0;padding:0;border:0;}#mainWrapper {margin: 0 auto; height:100%; background-color:pink;}</style></head><body><div id="mainWrapper"></div></body></html> Adding "stuff<br />" five times produces a bigger pink area covering the five times. The lesson is a div will expand to include the stuff in it. You don't need a different height on each page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.