Div "Height" Property Tip

Sometimes on a web page you have a div container with 2 or more divs within. In many cases, you'll want the background from one of the divs to fill the container div. Unfortunately, the div style property height does not support a percentage value as of XHTML 1.1. Instead, you can "fool" the div by repeating the background on the container control like this:

<div id="container" style="background-image: url('containerbkg.gif'); background-repeat: repeat-y;">
    <div id="menu" style="float: left; width: 100px;">
        Item 1<br/>
        Item 2
    </div>
    <div id="body" style="margin-left: 100px; width: 300pt;">
        Body goes here<br/><br/>
        Body continues here<br/><br/>
        Body ends here.
    </div>
</div>
Published Thursday, June 01, 2006 4:12 PM by Jason N. Gaylord

Comments

# re: Div "Height" Property Tip

Thursday, May 01, 2008 3:15 AM by Tobbs

Div height may be set to a % in some cases

www.webmasterworld.com/forum83/200.htm

# re: Div "Height" Property Tip

Tuesday, June 10, 2008 1:34 AM by netra

i want to autofit div tag height in mozilla browser, i have great problem, can you help me????????

Netra.

# re: Div "Height" Property Tip

Tuesday, March 23, 2010 9:17 PM by Duane

Hi guys. There are admirable potentialities in every human being. Believe in your strength and your youth. Learn to repeat endlessly to yourself, 'It all depends on me.' Help me! I can not find sites on the: Newsletter option stock trading. I found only this - <a href="www.fabrikant-records.net/.../online-stock-trading-comparison">online stock trading comparison</a>. Stock trading, actually having a many administration fraud is effectively a important nightmare as commercial range fee traders is n't several to brand. Business has given sometimes over 5 billion premises, stock trading. With respect :rolleyes:, Duane from Cyprus.

Leave a Comment

(required) 
(required) 
(optional)
(required)