如何摆脱页面元素之间的空白区域?

时间:2018-03-09 06:12:00

标签: html css html5 css3

我在导航栏和我的div之间摆脱了空白问题。我已经在使用normalize.css了,我尝试从页面上的每个元素中取出边距和填充。我也试过了!重要而且它没有效果。我相信这是一个简单的解决方案,我只是任何帮助将不胜感激。

/*General*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    cursor: pointer;
}

/*Navigation*/
 nav {
    width: 100%;
    background-color: #2b2b2b;
}

li {
  text-align: center;
  text-transform: uppercase;
  color: #fff;
  padding: 1rem 2rem 1rem 2rem;
  margin: 0;
}

ul {
  list-style-type: none;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
}

li:hover {
    color: #d6d6d6;
}

/*iPhoneX*/
.iphonex {
    background-image: url("http://res.cloudinary.com/dboauovcs/image/upload/c_scale,w_1200/v1520573356/iphonex_fwlohj.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    height: 100vh;
    color: #fff;
    text-align: center;
}

/*iphone 8*/

.iphone8 {
    background-image: url("http://res.cloudinary.com/dboauovcs/image/upload/c_scale,w_1200/v1520573369/iphone8_zx2ckf.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    height: 100vh;
    color: #fff;
    text-align: center;
    
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Apple Home Page - CSS Grid</title>
    <link href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" rel="stylesheet">
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    
    <!--Navbar-->
    <header>
        <nav>
            <ul>
                <li><i class="fab fa-apple"></i></li>
                <li>Mac</li>
                <li>iPad</li>
                <li>iPhone</li>
                <li>Watch</li>
                <li>TV</li>
                <li>Music</li>
                <li>Support</li>
                <li><i class="fas fa-search"></i></li>
                <li><i class="fas fa-shopping-bag"></i></li>
            </ul>
        </nav>
    </header>
    
    <!--Full width Iphone X img-->
    <div class="iphonex">
        <h1>iPhone X</h1>
        <h5>Say hello to the future.</h5>
    </div>
    
    <!--Full width Iphone 8 img-->
    <div class="iphone8">
        <h1>iPhone 8</h1>
        <h5>A new generation of iPhone.</h5>
    </div>
    
    <!--1/2 width HomePod img-->
    
    <!--1/2 width Apple watch img-->
    
    <!--1/2 Ipad pro img-->
    
    <!--1/2 Imac pro img-->
    
    <!--1/2 airpods img-->
    
    <!--1/2 enviormentally friendly img-->
    
    
    
    
</body>
</html>

0 个答案:

没有答案