[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

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

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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
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…

656 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