Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Help with Div Layout

Posted on 2011-03-15
4
Medium Priority
?
317 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 1000 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 1000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
Suggested Courses

730 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