Link to home
Start Free TrialLog in
Avatar of paddycobbett
paddycobbett

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

Avatar of paddycobbett
paddycobbett

ASKER

Thanks, I think this solution was preferable for my particular case.