Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a page with header and left-sidebar?

Tags:

I'd like to make a webpage like this:

|----------------------------| |            header          | |----------------------------| |  L  |                      | |  e  |                      | |  f  |                      | |  t  |                      | |     |                      | |  S  |   Content Area       | |  i  |                      | |  d  |                      | |  e  |                      | |  b  |                      | |  a  |                      | |  r  |                      | |----------------------------| 

The header has a fixed height but it's width should be dynamic. The left-sidebar should have a fixed width but a dynamic height. For the content area, both height and width are dynamic. When user scale their browser, the scrolling bar should not appear(not set overflow:hidden; to hide it.).

I tried to write code like this:

<div class="top">     TOP </div> <div class="left">     LEFT </div> <div class="main">     MAIN </div> 

with CSS:

.top {     width: 100%;     height: 92px; } .left {     width: 178px;     height: 100%;     float:left; } .main {     float: left;     height: 100%;     width: 100%;  } 

But it failed.

EDIT: Content Area and Left-SideBar must fill the whole browser window..... I don't need

|----------------------------| |            header          | |----------------------------| |  L  |                      | |  e  |                      | |  f  |                      | |  t  |                      | |     |                      | |  S  |   Content Area       | |  i  |                      | |  d  |----------------------| |  e  | |  b  | |  a  | |  r  | |-----| 
like image 211
Lingfeng Xiong Avatar asked Nov 02 '12 05:11

Lingfeng Xiong


People also ask

How do I create a header and sidebar in HTML?

The header has a fixed height but it's width should be dynamic. The left-sidebar should have a fixed width but a dynamic height. For the content area, both height and width are dynamic. When user scale their browser, the scrolling bar should not appear(not set overflow:hidden; to hide it.).

How do I put the header on the left side in HTML?

To set the heading alignment in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <h1> to <h6> tag, with the CSS property text-align. HTML5 do not support the align attribute of the heading tag, so the CSS style is used to set alignment.

How do I keep my sidebar fixed?

The easiest way to handle this is just to use CSS fixed positioning. Our sidebar is within a #page-wrap div with relative positioning, so the sidebar will set inside there, then we just push it over into place with margin. With this technique, the sidebar stays solidly in place as you scroll down the page.

How do you create a header in HTML?

The <header> tag in HTML is used to define the header for a document or a section as it contains the information related to the title and heading of the related content. The <header> element is intended to usually contain the section's heading (an h1-h6 element or an <hgroup> element), but this is not required.


1 Answers

example at jsFiddle

.top {     position:absolute;     left:0; right:0;     height: 92px; } .left {     position:absolute;     left:0; top:92px; bottom: 0;     width: 178px; } .main {     position: absolute;     left:178px; top:92px; right:0; bottom:0; } 
like image 112
Lee Avatar answered Oct 21 '22 03:10

Lee