2017-02-15 70 views
0

我當前正在嘗試將頁面分成兩個在兩側都有一個邊框的美學和垂直部分。問題是我有兩個部分的寬度:49vw;並且邊框的大小是1vw,等於100vw,但是這些部分在彼此之下跳躍而不是內聯。我建立了一個JSfiddle,因此更容易顯示。下面是JSfiddle附帶的代碼。將頁面劃分爲兩個帶有邊框的垂直和美學部分

HTML:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<link rel="stylesheet" href="css/reset.css" media="screen" type="text/css" /> 
<link rel="stylesheet" href="css/styles.css" media="screen" type="text/css" /> 
</head> 
<body> 
<!--SECTION 1--> 
    <div class="section1"> 
     <p>2D</p> 
    </div> 
<!--SECTION 2--> 
    <div class="section2"> 
     </p>3D</p> 
    </div> 
</body> 
</html> 

CSS:

.section1{ 
    background-color:#11181e; 
    width:49vw; 
    float:left; 
    height:100vh; 
    border-right: 1vw solid #F5E5D6; 
    margin:0; 
    padding:0; 
} 
.section2{ 
    background-color:#f1c40f; 
    width:49vw; 
    float:left; 
    height:100vh; 
    border-left: 1vw solid #000; 
    margin:0; 

這裏是鏈接:http://jsfiddle.net/VfTYs/4/

感謝您的幫助。

回答

0

.section1.section2上使用width: 50%;box-sizing: border-box

body{ 
 
\t color:#fff; 
 
\t font-size:100pt; 
 
} 
 
.section1{ 
 
\t background-color:#11181e; 
 
\t width:50%; 
 
\t float:left; 
 
\t height:100vh; 
 
\t border-right: 1vw solid #F5E5D6; 
 
    box-sizing: border-box; 
 
    margin:0; 
 
    padding:0; \t 
 
} 
 
.section2{ 
 
\t background-color:#f1c40f; 
 
\t width:50%; 
 
\t float:left; 
 
\t height:100vh; 
 
\t margin:0; 
 
\t padding:0; 
 
    box-sizing: border-box; 
 
}
<div class="section1"> 
 
2d 
 
</div> 
 
<div class="section2"> 
 
3d 
 
</div>

+0

我也取消了'.section2'黑色邊框。 – Jesse

+0

令人驚歎,謝謝。 – Animalovsky

+0

沒問題,祝你的項目好運!如果我回答了您的問題,請介意將綠色複選標記扔給我? – Jesse