2017-09-28 11 views
0

私はあなたに別の質問があります。私はMr.RobotのWebファンページのようなものを作ることにしました。私はhtmlを練習したいと思っていますし、CSS + JSを学びます。しかし、私は解決できない問題があります。 divの間にスペースがあります。私はそれを削除する方法を多くのチュートリアルを試みたが、それらのどれも助けなかった。 enter image description heredivの間に少しのスペース

body { 
 
    width: 100%; 
 
    height: 100%; 
 
    margin-left: 0px; 
 
    margin-top: 0px; 
 
} 
 

 
#main { 
 
    height: 100%; 
 
    width: 100%; 
 
} 
 

 
header { 
 
    background: black; 
 
    padding: 1px; 
 
    max-width: 100%; 
 
} 
 

 
header p { 
 
    margin-left: 50px; 
 
    font-family: 'Inconsolata', monospace; 
 
    font-size: 50px; 
 
    text-align: center; 
 
} 
 

 
.barva { 
 
    color: #B20707; 
 
} 
 

 
.menu { 
 
    height: 100%; 
 
    width: 0; 
 
    position: fixed; 
 
    z-index: 1; 
 
    top: 0; 
 
    left: 0; 
 
    background: black; 
 
    overflow-x: hidden; 
 
    transition: 0.5s; 
 
    padding-top: 60px; 
 
} 
 

 
.menu a { 
 
    display: block; 
 
    text-decoration: none; 
 
    color: white; 
 
    font-size: 20px; 
 
    padding: 8px; 
 
    transition: 0.3s; 
 
    margin-left: 20px; 
 
    font-family: 'Poppins', sans-serif; 
 
} 
 

 
.menu a:hover { 
 
    color: #B20707; 
 
} 
 

 
.Openbt { 
 
cursor: pointer; 
 
position:absolute; 
 
top: 0; 
 
left: 0; 
 
margin-top: 20px; 
 
margin-left: 10px; 
 
float:left; 
 
color: #B20707; 
 
font-size: 50px; 
 
} 
 

 
.menu .closebt { 
 
    position: absolute; 
 
    top: 0; 
 
    right: 25px; 
 
    font-size: 36px; 
 
    margin-left: 50px; 
 
    color: #B20707; 
 
} 
 

 

 
@media screen and (max-height: 450px) { 
 
    .sidenav {padding-top: 15px;} 
 
    .sidenav a {font-size: 18px;} 
 
} 
 

 
} 
 
.domu { 
 
    height: auto; 
 
} 
 

 
img 
 
{ 
 
    max-width: 100%; 
 
} 
 

 
.about { 
 
    height: auto; 
 
    max-width: 100%; 
 
    min-height: 250px; 
 
    background: black; 
 
}
<!doctype html> 
 
<html lang="cs-cz"> 
 
<head> 
 
    <link href="https://fonts.googleapis.com/css?family=Arimo" rel="stylesheet"> 
 
    <link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet"> 
 
    <link href="https://fonts.googleapis.com/css?family=Poppins" rel="stylesheet"> 
 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> 
 
    <link rel="stylesheet" type="text/css" href="style.css"> 
 
    <meta charset="utf-8"> 
 
    <title>Yaaa boiii</title> 
 
</head> 
 
<body> 
 

 
    <header> 
 
     <p style="color:white "><span class="barva">ID:_ROOT:</span>Our<span class="barva">_democracy_</span>has<span class="barva">_</span><span class="barva">been</span>_hacked</p> 
 
     <div class=Openbt> 
 
    <span onclick="openNav()"><i class="fa fa-bars"></i></span> 
 
     </div> 
 
    </header> 
 

 
<div id="mySidemenu" class="menu"> 
 
    <a href="javascript:void(0)" class="closebt" onclick="closeNav()">&times;</a> 
 
    <a href="#">Home</a> 
 
    <a href="#">Home</a> 
 
    <a href="#">Home</a> 
 
    <a href="#">Home</a> 
 
    <a href="#">Home</a> 
 
</div> 
 

 
<div id="main"> <!-- Veškerý kontent --> 
 
    <div class="domu"> 
 
    <img src="obrazky/robot.jpg" width="1920" height="1000" /> 
 
    </div> 
 
    <div class="about"> 
 

 
    </div> 
 
</div> 
 

 
<script> 
 
    function openNav() { 
 
    document.getElementById('mySidemenu').style.width = "250px"; 
 
    document.getElementById('header').style.marginLeft = "250px"; 
 
    document.getElementById("main").style.marginLeft = "250px"; 
 
    } 
 
    function closeNav() { 
 
    document.getElementById('mySidemenu').style.width = "0px"; 
 
    document.getElementById("main").style.marginLeft = "0px"; 
 
    } 
 
</script> 
 

 
</body> 
 
</html>

たぶん、あなたは、私が絵にいくつかの幅と高さを設定しなければならなかったことに気づきました。高さを100%、幅を100%に設定するにはどうすればよいですか? .domuに入力しようとしましたが、動作しませんでした。

+0

[HTML、CSS - 写真下の奇妙な目に見えないマージン]の可能な重複(https://stackoverflow.com/questions/1383048/html-css-weird-invisible-margin-below -ピクチャー) – showdev

答えて

3

2つの解決策には、両方ともあなたのCSSを変更することが含まれます。

1)体の背景色を背景色に合わせて変更することができます。これはあなたのCSSに以下を追加することで行うことができます。

body 
{ 
    background: black; 
} 

2)あなたは、あなたのimgタグにdisplay: block;スタイルを使用することができます。

<img src="obrazky/robot.jpg" width="1920" height="1000" style="display: block;"/> 

幸運

関連する問題