* {
  box-sizing: border-box;
}

h1 {
  text-align: center;
  font-family: sans-serif;
  font-weight: normal;
  padding-bottom: 20px;
}


#section1{
	margin-right: 10px;
}
#section2{
	margin-right: 10px;
}

div div {
  border: 1px solid;
  width: 90%;
  background-color: #9E9E9E;
  position: relative;
  margin-bottom: 10px;
  margin-left: auto;
  margin-right: auto;
}

div div div {
  text-align: center;
  position: absolute;
  right: 0;
  top: 0;
  margin: 0px;
  font-weight: bold;
}

#Chicken {
  background-color: #EF9A9A;
  width: 25%;
  border: 1px solid;
}

#Beef {
  background-color: #F44336;
  width: 25%;
  border: 1px solid;
  color: white;
  border-color: black;
}

#Sushi {
  background-color: #CDDC39;
  width: 25%;
  border: 1px solid;
}

p {
  padding: 10px;
}

.row {
  width: 100%;
}

@media (min-width: 992px) {
  .col-lg-1,
  .col-lg-2,
  .col-lg-3,
  .col-lg-4,
  .col-lg-5,
  .col-lg-6,
  .col-lg-7,
  .col-lg-8,
  .col-lg-9,
  .col-lg-10,
  .col-lg-11,
  .col-lg-12 {
    float: left;
  }
  .col-lg-1 {
    width: 8.33%;
  }
  .col-lg-2 {
    width: 16.66%;
  }
  .col-lg-3 {
    width: 25%;
  }
  .col-lg-4 {
    width: 33.33%;
  }
  .col-lg-5 {
    width: 41.66%;
  }
  .col-lg-6 {
    width: 50%;
  }
  .col-lg-7 {
    width: 58.33%;
  }
  .col-lg-8 {
    width: 66.66%;
  }
  .col-lg-9 {
    width: 74.99%;
  }
  .col-lg-10 {
    width: 83.33%;
  }
  .col-lg-11 {
    width: 91.66%;
  }
  .col-lg-12 {
    width: 100%;
  }
}

@media (min-width: 767px) and (max-width: 991px) {
  .col-md-1,
  .col-md-2,
  .col-md-3,
  .col-md-4,
  .col-md-5,
  .col-md-6,
  .col-md-7,
  .col-md-8,
  .col-md-9,
  .col-md-10,
  .col-md-11,
  .col-md-12 {
    float: left;
  }
  .col-md-1 {
    width: 8.33%;
  }
  .col-md-2 {
    width: 16.66%;
  }
  .col-md-3 {
    width: 25%;
  }
  .col-md-4 {
    width: 33.33%;
  }
  .col-md-5 {
    width: 41.66%;
  }
  .col-md-6 {
    width: 50%;
  }
  .col-md-7 {
    width: 58.33%;
  }
  .col-md-8 {
    width: 66.66%;
  }
  .col-md-9 {
    width: 74.99%;
  }
  .col-md-10 {
    width: 83.33%;
  }
  .col-md-11 {
    width: 91.66%;
  }
  .col-md-12 {
    width: 100%;
  }
}

<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Assignment solution for module 2</title>
  <link rel="stylesheet" href="css">
</head>

<body>
  <h1> Our Menu</h1>
  <div class="row">
    <div id="section1" class="col-lg-4 col-md-6 col-xs-12">
      <div id="Chicken">Chicken</div>
      <p> lorem ipsum dolor sit amet, concectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
      </p>
    </div>
    <div id="section2" class="col-lg-4 col-md-6">
      <div id="Beef">Beef</div>
      <p> lorem ipsum dolor sit amet, concectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
      </p>
    </div>
    <div id="section3" class="col-lg-4 col-md-12">
      <div id="Sushi">Sushi</div>
      <p> lorem ipsum dolor sit amet, concectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
      </p>
    </div>
  </div>
</body>

</html>





如何在大屏幕视图的框之间添加页边距有人可以看到如何做到这一点。我试图在大屏幕视图中的框之间添加边距,但它根本不显示,它只是折行并在下一行显示。
它也必须像其他尺寸的指定一样正确查看。

最佳答案

我从一个社区为您的帖子获得了一些相关的代码,请在下面找到。

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
    box-sizing: border-box;
}
.header {
    border: 1px solid red;
    padding: 15px;
}
.menu {
    width: 25%;
    float: left;
    padding: 15px;
    border: 1px solid red;
}
.main {
    width: 75%;
    float: left;
    padding: 15px;
    border: 1px solid red;
}
</style>
</head>
<body>

<div class="header">
  <h1>Chania</h1>
</div>

<div class="menu">
  <ul>
    <li>The Flight</li>
    <li>The City</li>
    <li>The Island</li>
    <li>The Food</li>
  </ul>
</div>

<div class="main">
  <h1>The City</h1>
  <p>Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.</p>
  <p>Resize the browser window to see how the content respond to the resizing.</p>
</div>

</body>
</html>

10-08 13:37