2012-11-10 76 views
0

我試圖讓我的基本網頁佈局在一起,我遇到了一些問題。有人可以幫我解決它。我對CSS的理解並不高超。網頁佈局結構

代碼:http://jsfiddle.net/HJLzt/

  1. 粘性頁腳的工作,我想在頁面的左邊一列,就在頁眉和頁腳之間。我不確定我做的方式是否正確。

  2. 在左列和右列與頁眉和頁腳之間我想放內容。我如何居中。我無法找到合適的方法,因爲總會出現溢出現象,我只希望它在左列和右列之間移動,並且不需要切斷。

謝謝你的幫忙!

編輯: 我已經更新了我的佈局,並用了一點jquery來幫忙。我知道我應該儘量讓所有的東西在CSS中工作,但似乎不可能。

也許我應該補充說,我想要一個白板作爲主題。我想要一個木製框架,所以側邊欄總是必須連接到頁眉和頁腳,因爲頂部和底部框架都在那裏通過。

如果有人可以看看,並告訴我,如果這是好的或不。

* { margin:0; padding:0; } 

html, body, #wrap { height: 100%; } 

body > #wrap {height: auto; min-height: 100%;} 

#main { padding-bottom: 150px; } /* must be same height as the footer */ 

#main header{ 
    height: 100px; 
    width: 100%; 
    background-color: #5d3be6; 
} 

footer{ 
    position: relative; 
    margin-top: -150px; /* negative value of footer height */ 
    height: 150px; 
    clear:both; 
    background-color: #afeba4; 
} 


/* CLEAR FIX*/ 
.clearfix:after {content: "."; 
    display: block; 
    height: 0; 
    clear: both; 
    visibility: hidden;} 
.clearfix {display: inline-block;} 
/* Hides from IE-mac \*/ 
* html .clearfix { height: 1%;} 
.clearfix {display: block;} 
/* End hide from IE-mac */ 

#layout_left{ 
    float: left; 
    width: 100px; 
    min-height: 100%; 
    height: 100%; 
    background-color: #f21ce7; 
} 

#layout_right{ 

    float: right; 
    width: 100px; 
    min-height: 100%; 
    height: 100%; 
    background-color: #f21ce7; 
} 

#content_layout{ 
    border-left: 100px solid #e4f662; 
    border-right: 100px solid #e4f662; 
    width: auto; 
    height: auto; 
    background-color: #c36161; 
} 

#content{ 
    margin: auto; 
    width: 96%; 
} 

回答

0

正如你所說,你是CSS的新手,但我非常推薦你的佈局,這似乎是10年前的標準。 (沒有違法的意圖,你是新來的,你不會知道這個做什麼,現在還不是)。

研究網上投資組合示例使用谷歌的想法!

回答你的問題:

我承認你的粘頁腳代碼,我並沒有爲我工作之一,也並非完全如此。

它不工作的偉大,我建議:http://css-tricks.com/snippets/css/sticky-footer/

我會告訴你我自己但教程是寫得很好,易於理解和執行。

而對於定心容器用途:幫助

text-align: center; 

希望:

margin: 0 auto; 

居中文本,您可以使用。

+0

謝謝你的幫助。我會放手一搏! – Tino