2012-07-23 74 views
0

我需要將2個div放在一起,第一個頁面的寬度爲%20,第二個頁面的寬度爲%80。我不知道我必須給予div。相對,固定,絕對,繼承?2頁在頁面旁邊

我該怎麼辦?

+0

檢查http://stackoverflow.com/questions/4882206/css-problem-to-make-2-divs-float-side-by-side http://stackoverflow.com/questions/ 5387392/how-to-get-these-two-divs-side-by-side http: //stackoverflow.com/questions/5803023/how-to-place-two-divs-next-to-each-other http://stackoverflow.com/questions/9683254/align-2-divs-side-by-side – 2012-07-23 05:22:48

+0

@Erdinc在提出問題之前先做一個搜索,然後嘗試先看到相關答案...... – 2013-02-22 07:40:42

回答

5

你可以這樣寫:

.firstdiv{ 
width:20%; 
float:left; 
} 
.secdiv{ 
overflow:hidden; 
} 

檢查這個fiddle

1

不要給任何位置的div只使用float:left;和寬度設置爲80%(或79%)和20%如常

div_first 
{ 
float:left; 
width:79%; 
} 
div_second 
{ 
float:left; 
width:20%; 
}