Solved

How can I markup my html to achieve the desired result in my diagram?

Posted on 2013-11-23
3
237 Views
Last Modified: 2013-11-25
Is there a clean way to achieve the result in the diagram with html and css? My goal is to have the header and page be centered, with some side panel off to the side. The key part is that the side panel should be vertically top aligned with the page div. I want a solution which will automatically work irrespective of the height of the header, i.e I'm not fixing the side panel top position to accommodate the header height. I am pulling in bootstrap (for other reasons) so feel free if necessary to reference (or not) anything from there. Please note that the header and page do have set widths, i.e should use or be embedded within a div with class "sitewidth".

Suggested starting points could be:

<div class="centered sitewidth">
	<div id="header"></div>
	<div id="page"></div>
</div>

Open in new window


OR

	<div id="header" class="centered sitewidth"></div>
	<div id="page" class="centered sitewidth"></div>

Open in new window


Where can I put the side panel div to get the desired result?
Untitled.png
0
Comment
Question by:paddycobbett
[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
3 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39671935
You can do something like this
http://jsfiddle.net/GaryC123/ag43D/2/

<div id="container">
<div id="header">Header</div>
<div id="innercontainer">
<div id="side">Side</div>
<div id="page">Page</div>
</div>
</div>

Open in new window

#header {
    width:100px;
    margin:0 auto
}
#container {
    width:200px;
    margin:auto ;
}
#innercontainer {
    margin-left:-50px;
}
#page {
    width:100px;
    margin:0 auto;
    float:left;
}
#side {
    width:100px;
float:left
}

Open in new window

0
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39671974
I like using pre made grid's for this.  Because mobile has become so important, I like responsive grid's from http://getbootstrap.com/ or http://foundation.zurb.com/

In bootstrap http://jsbin.com/uCusEVI/1/ you can see for larger screens you see your sample, but in smaller screens, the div's stack.  It gets more complex to build the page, but makes it easier for mobile, tab and desktop users with one  page.

<div class="row">
  <div class="col-md-8 col-md-offset-2">Header</div>
</div>
<div class="row">
     <div class="col-md-2">Left</div>
     <div class="col-md-10">Middle</div>
<div>

Open in new window

0
 
LVL 1

Author Closing Comment

by:paddycobbett
ID: 39676402
Thanks, I think this solution was preferable for my particular case.
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

717 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