Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Height of div.

  1. #1
    New Coder
    Join Date
    Oct 2011
    Posts
    81
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Height of div.

    I tried to make this simple layout:

    http://i39.tinypic.com/e7ml4p.gif

    Now I want the menu (nav) to be the same height as the two content divs (test). Is there any way to do this?

    HTML:

    Code:
    <body>
    
    <div id="container">
    
    	<header>
    		<h1>This is the header.</h1>
    	</header>
    	
    	<nav>
    		<h2>Menu</h2>
    		<ul>
    			<li><a href="link.html">Link 1</a></li>
    			<li><a href="link.html">Link 2</a></li>
    		</ul>
    	</nav>
    	
    	<div id="test">
    		<h2>This is a title.</h2>
    		<p>test</p>
    	</div>
    	
    	<div id="test">
    		<h2>This is another title.</h2>
    		<p>test</p>
    	</div>
    	
    	<footer>
    		<p><small>footer.</small></p>
    	</footer>
    	
    </div>
    CSS:

    Code:
    body{
    	width: 700px;
    	margin: 0;
    	padding: 0;
    	font-family: georgia;
    	margin: 0 auto 0 auto;
    }
    
    header, nav, footer, #test{
    	display: block; 
    }
    
    header{
    	background: #cccccc;
    	-moz-border-radius: 15px;
    	border-radius: 15px;
    }
    
    nav{
    	float: left;
    	width: 17%;
    	background: #cccccc;
    	-moz-border-radius: 15px;
    	border-radius: 15px;
    	padding: 10px;
    }
    
    #test{
    	float: right;
    	width: 75%;
    	background: #cccccc;
    	-moz-border-radius: 15px;
    	border-radius: 15px;
    	padding: 10px;
    	margin: 0 0 15px 0;
    }
    
    footer{
    	clear: both;
    	background: #cccccc;
    	-moz-border-radius: 15px;
    	border-radius: 15px;
    }

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello apotd,
    The normal methods won't work with your rounded corners.
    Here is a jQuery solution - http://nopeople.com/CSS%20tips/jQuer...mns/index.html
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New Coder
    Join Date
    Oct 2011
    Posts
    81
    Thanks
    1
    Thanked 0 Times in 0 Posts
    And if I'd remove the rounded corners, how would I do it in that case?

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by apotd View Post
    And if I'd remove the rounded corners, how would I do it in that case?
    You can do it with a background color or an image repeated on the y axis.
    Look at my faux columns demo. You can google faux columns for a million more examples.

    Here's another equal height columns method that works very well too.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #5
    New Coder
    Join Date
    Oct 2011
    Posts
    81
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thank you, this works fine. I forgot how I should mark this question as resolved though, since I can't seem to edit my first post.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •