Solved

Help with Div Layout

Posted on 2011-03-15
4
315 Views
Last Modified: 2012-05-11
I'm having trouble with a simple Div layout. Below is my current code. I've also attached an image (sample_layout.jpg) I'm trying to achieve. My current code doesn't work right.


<div id="wrapper" style="width:900px;border:1px solid black;">
	<div id="header" style="float:left;background:#cccccc;width:600px;height:100px"><h1>Title</h1></div>
	<div id="utils" style="float:right;text-align:right;background:#eeeeee;width:200px;height:100px">Help</div>
	<div id="content" style="background:#666666">
		Main Content Content
	</div>
</div>

Open in new window

sample-layout.jpg
0
Comment
Question by:greddin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

Expert Comment

by:Paul Jackson
ID: 35142677
try :

   <div id="wrapper" style="width:900px;border:1px solid black;"> 
   <div id="headerwrapper" style="width:100%;height:100px">
        <div id="header" 
            style="float:left;background:#cccccc;width:700px; height:100px"><h1>Title</h1></div> 
        <div id="utils" style="float:right;text-align:right;background:#eeeeee;width:200px;height:100px"><h1>Help</h1></div> 
   </div>
   <div id="content" style="background:#666666;height:500px"> 
                <h1>Main Content</h1>
   </div> 
</div> 

Open in new window

0
 
LVL 5

Accepted Solution

by:
meb_santoso earned 250 total points
ID: 35142697
If you are trying to achieve this:

 screen caps
Try this code: (change the colors and the border, it's only for cosmetics )

<div id="wrapper" style="width:900px;border:5px solid #FF0;">
	<div id="header" style="float:left;background:#00F;width:600px;height:100px">
    	<h1>Title</h1>
    </div>
	<div id="utils" style="float:right;text-align:right;background:#0F0;width:200px;height:100px">
    	Help
    </div>
    <div style="clear:both;"></div>
	<div id="content" style="background:#F00">
		Main Content Content
	</div>
</div>

Open in new window


What's forgotten from time to time is the following:
<div style="clear:both;"></div>

Open in new window

0
 
LVL 29

Assisted Solution

by:Paul Jackson
Paul Jackson earned 250 total points
ID: 35142714
Update without the header wrapper div which wasn't really needed:
   <div id="wrapper" style="width:900px;border:1px solid black;"> 
        <div id="header" 
            style="float:left;background:#cccccc;width:700px; height:100px"><h1>Title</h1></div> 
        <div id="utils" style="float:right;text-align:right;background:#eeeeee;width:200px;height:100px"><h1>Help</h1></div> 
   <div id="content" style="background:#666666;height:500px"> 
                <h1>Main Content</h1>
   </div> 
</div>

Open in new window

0
 

Author Closing Comment

by:greddin
ID: 35143798
Thanks guys for the the layouts. Both are actually just what I needed. I couldn't decide which to choose so I split the points.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question