?
Solved

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

Posted on 2013-11-23
3
Medium Priority
?
240 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 2000 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

WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
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 embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

770 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