如何删除基本HTML网站底部2 div的边距?

时间:2016-02-07 21:25:19

标签: html css

以下是我网站的代码。当.jumbotron的宽度为100%时,我试图找出为什么在底部两个div上有正确的边距。

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="main.css" rel="stylesheet"/>
<title>Vasilios Lambos</title>
</head>

<body>
<header role="banner">
<div id="fixed">
<nav role="navigation">
<ul>
    <li><a href="home.html">Home</a></li> 
    <li><a href="portfolio.html">Portfolio</a></li>
    <li><a href="process.html">Process</a></li>
    <li><a href="https://www.linkedin.com/in/vasilios-lambos-81220366">Contact</a></li>
</ul>
</nav>
</div>
</header>

<div class="jumbotron">
<img src="IMG_1677.jpg" width="200" height="200"/>
<h1>Vaslios Lambos</h1>
<p>Industrial and Interaction Designer</p>
<p>Always staying hungry to learn new and inspiring ways to improve my creative process. I utilize design thinking, research methods, and ethonography to explore user experience and services. Core hard skills consist of user interface design, product rendering, and testing.</p>
</div>
<div class="pics">
<img src="VL-Logo.png" width="200" height="200"/>
</div>
<div class="info">
<div class="container">
<h3>Overview</h3>
<p> ### </p>

</div>

</div>
<div class="footer">
<h3>Soft & Hard skills</h3>
<ul>
    <li>Adobe Suite</li>
    <li>Axure RP</li>
    <li>HTML/CSS/Javascript</li>

</ul>

</div>


</body>
</html>

请注意,在浏览器中预览时,jumbotron在100%以及信息div和页脚的右侧都有边距的CSS。

@charset "UTF-8";

@font-face {
font-family: Verdana, Geneva, sans-serif;
}
body {
font-family:Verdana, Geneva, sans-serif;
background-color: #FFF;
}
*{margin:0;padding:0;}

#fixed ul{
position:fixed;
top:0px;
width:100%;
z-index:9999;
list-style-type:none;
margin: 0;
padding: 0;
overflow:hidden;
background-color: #FFF;
}
nav li{
float:left;
}   
nav li a{
display:block;
color: #000;
font-size: 11px;
font-weight: bold;
padding:20px;
text-transform:uppercase;
text-decoration:none;
}

nav a:hover {
 background-color: orange;
 }

div.jumbotron {
margin-top:80px;
margin-left:auto;
margin-right:auto;
padding:10px;
height:500px;
width:100%;
color:white;
text-align:center;
background-color:#000
} 
.jumbotron p{
width:500px;
margin-left:inherit;
margin-right:inherit;
}
.jumbotron img {
border-radius: 50%;
}
.pics{
display:inline;
height:232px;
width:232px;
padding:0;
margin:0;
}
.pics img{
padding:15px;
border:1px solid #ccc;
background-color: #eee;
width:200px;
height:200px;
}

div.info {
background-color: #000;
color:white;
padding:20px;
height:400px;
}
div.footer{
background-color:#000;
color:white;
clear:both;
height:400px;
padding:20px;
}

1 个答案:

答案 0 :(得分:0)

HTML没问题

Here is the PEN

CSS后跟/* -------------- ADDED */是更改

这是CSS

  @font-face {
    font-family: Verdana, Geneva, sans-serif;
  }

  body {
    font-family: Verdana, Geneva, sans-serif;
    background-color: #FFF;
  }

  * {
    margin: 0;
    padding: 0;
  }

  #fixed ul {
    position: fixed;
    top: 0px;
    width: 100%;
    z-index: 9999;
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #FFF;
  }

  nav li {
    float: left;
  }

  nav li a {
    display: block;
    color: #000;
    font-size: 11px;
    font-weight: bold;
    padding: 20px;
    text-transform: uppercase;
    text-decoration: none;
  }

  nav a:hover {
    background-color: orange;
  }

  div.jumbotron {
    margin-top: 80px;
    margin-left: auto;
    margin-right: auto;
    padding: 10px;
    height: 500px;
    width: 100%;
    color: white;
    text-align: center;
    background-color: #000;
    box-sizing: border-box; -------------- ADDED */
  }

  .jumbotron p {
    width: 500px;
    margin-left: inherit;
    margin-right: inherit;
  }

  .jumbotron img {
    border-radius: 50%;
  }

  .pics {
    display: inline;
    height: 232px;
    width: 232px;
    padding: 0;
    margin: 0;
  }

  .pics img {
    padding: 15px;
    border: 1px solid #ccc;
    background-color: #eee;
    width: 200px;
    height: 200px;
  }

  div.info {
    background-color: #000;
    color: white;
    padding: 20px;
    height: 400px;
      width: 100%;  /* ------------ ADDED */
      box-sizing: border-box; /* -------------- ADDED */
  }

  div.footer { 
    background-color: #000;
    color: white;
    clear: both;
    height: 400px;
    padding: 20px;
      width: 100%;  /* -------------- ADDED */
      box-sizing: border-box; /* -------------- ADDED */
  }