2015-01-03 26 views
-1

我是一個新手在HTML和my page,我有我的兩個部分是不連續的問題:部分不是連續

.privitanie{ 
 
position: absolute; 
 
background: url("../images/pozadie.jpg"); 
 
background-repeat: no-repeat; 
 
background-size: 100% 100%; 
 
width: 100%; 
 
height: 100%; 
 
top: 0; 
 
z-index: 0; 
 
} 
 

 
.uvod{ 
 
position: relative; 
 
z-index: 0; 
 
height: 100%; 
 
}
<section class="privitanie" id="privitanie">...</section> 
 

 
<section class="uvod" id="uvod">...</section>

回答

1

絕對定位的元素在文檔流之外。其他元素根據它們在標記中的位置最終分層在上面或下面。使兩者相對,或給予.uvod頂部空白等於.privitanie的高度。

0

這裏有一個簡單的解決方案,不需要改變太多的代碼:任何你喜歡

.uvod{ 
    position: relative; 
    margin-top: 50%; 
    z-index: 0; 
    height: 100%; 
} 

更改邊距。

+0

margin-top:50%與菜單混亂但填充頂部:50%很好,謝謝 –