滚动条显示宽度为100%时

时间:2020-09-26 16:51:21

标签: html css

嗨,我对底部滚动条(宽度100%)有疑问

肯定地进行了怀疑,因此假装引起了直率的怀疑。报纸或可以接受的教育活动。肢体极好的确定性话语的诚意没有他如此相似。欢乐之家更糟的是出现了总男孩。老人做鸡的感觉就是。就像看到的一样,在租金上一点都不情愿。行为极为她所解释的情况而九月的先生是谁。被认为或有针对性地听到他。

您自己摆脱了欣喜若狂的现在的法律。是的,他们的笑容似乎是歌曲。展望床上鄙视分开。她的询问使我们害羞而感慨。山寨胖子亲爱的自己到了老。坟墓中寡妇的时间不多,你不带头。权力使这些人最少也没有年轻。然而比赛错了他的我们。

哦,他果断地给人以依恋的感觉,所以一切都好。她的谁享受首席新青年。如果你们需要的话,幸福也是如此令人怀疑。因此应注意按规定否则存在的方向。不高兴地宣布自己不愉快哦。优势年龄导致听力归属的假设。

* {
  margin: 0;
  padding: 0;
}

body {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  background-color: #f6f6f6;
}

.nav {
  width: 100vw ;
  background-color: rgba(0, 0, 0, 0.75);
  height: 10vh;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 3fr 1fr;
  grid-gap: 1em;
  justify-content: center;
  align-items: center;
}

.logo {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-image {
  height: 10vh;
  width: auto;
}

ul {
  width: 100%;
  height: 80%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-gap: 5px;
  justify-content: center;
  align-items: center;
}

li {
  height: 100%;
  list-style: none;
  /* ============================center text ===================================*/
  display: flex;
  align-items: center;
  justify-content: center;
  /* ============================center text ===================================*/
}

li > a {
  color: white;
  text-decoration: none;
  font-size: 25px;
}

.order-button {
  height: 80%;
  color: white;
  font-size: 15px;
  text-align: center;
  text-decoration: none;
  /* ============================center text ===================================*/
  display: flex;
  align-items: center;
  justify-content: center;
  /* ============================center text ===================================*/
  transition: all 300ms;
  border-radius: 10px;
  background-color: #ff7e67;
}

.order-button:hover {

}

.header {
  height: 90vh;
  width: 100vw;
  background: url('https://images.pexels.com/photos/3758133/pexels-photo-3758133.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260') fixed;
  background-size: cover;
  background-position: center center;
}
.header-overlay {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, .75);
 /* ============================center text ===================================*/
  display: flex;
  align-items: center;
  justify-content: center;
  /* ============================center text ===================================*/   
}


.header-text {
  color: white;
  font-size: 100px;
  /* ============================center text ===================================*/
  display: flex;
  align-items: center;
  justify-content: center;
  /* ============================center text ===================================*/
}

.description {
  width: 60vw;
  height: 25vh;
  position: absolute;
  bottom: -12.5vh;
  left: 20vw;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-gap: 0.05px;
}

.disc-box {
  height: 100%;
  background-color: white;
  border: 1px solid gray;
}

.menu {
  width: 95vw;
  height: 75vh;
  background-color: black;
  margin-top: 120px;
}


.comment-1 {
  width: 100vw;
  height: 50vh;
  background: url('https://images.pexels.com/photos/1092730/pexels-photo-1092730.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260') fixed;
  background-size: cover;
  background-position: center center;
}

.gallery {
  height: auto;
  width: 95vw;
  background-color: white;
  display: grid;
  grid-template-columns: repeat(auto-fill, 585px);
  grid-gap: 30px;
  justify-content: space-evenly;
  margin: 20px;
}

.gallery-image {
  height: 50vh;
  overflow: hidden;
}

img {
  width: 100%;
}

.comment-2 {
  width: 100vw;
  height: 50vh;
  background: url('https://images.pexels.com/photos/3184306/pexels-photo-3184306.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260') fixed;
  background-size: cover;
  background-position: center center;
}

.contact {
  width: 95vw;
  height: 75vh;
  background-color: purple;
}

footer {
  height: 25vh;
  width: 100vw;
  background-color: #2c3e50;
}

.overlay {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, .75);
  display: flex;
  align-items: center;
  /* Vertical center alignment */
  justify-content: center;
  /* Horizontal center alignment */
}

.comment-text {
  font-size: 70px;
  color: white;
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>restaurent</title>
    <link rel="stylesheet" href="style2.css" />

</head>

<body>
   <div class="nav">
      <div class="logo">
          <img src="https://imagizer.imageshack.com/img923/8324/VbQDbs.jpg" alt="" class="logo-image">
      </div>
      
      <ul>
          <li class="nav-link"><a href="">home</a></li>
          <li class="nav-link"><a href="">about us</a></li>
          <li class="nav-link"><a href="">home</a></li>
          <li class="nav-link"><a href="">contact us</a></li>
      </ul>
      
      <a href="#" class="order-button">
          <h1>button</h1>
      </a>
   </div>
   
   <div class="header">
      <div class="header-overlay">
        <h1 class="header-text">hello world</h1>
      </div>
      <div class="description"></div>
   </div>

   <div class="description">
      <div class="disc-box"></div>
      <div class="disc-box"></div>
      <div class="disc-box"></div>
   </div>
   
   <div class="menu"></div>
   
   <div class="comment-1">
      <div class="overlay">
          <h1 class="comment-text">hello world</h1>
      </div>
   </div>

   <div class="gallery">
      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/1581384/pexels-photo-1581384.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>

      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/1581384/pexels-photo-1581384.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>

      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/842142/pexels-photo-842142.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>
      
      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/2641886/pexels-photo-2641886.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>
      
      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/5938/food-salad-healthy-lunch.jpg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>

      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/2159065/pexels-photo-2159065.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>
      
    </div>
    
    <div class="comment-2">
        <div class="overlay">
            <h1 class="comment-text">hello world</h1>
        </div>
    </div>

    <div class="contact"></div>

    <footer></footer>

</body>

</html>

1 个答案:

答案 0 :(得分:-1)

* {
  margin: 0;
  padding: 0;
}

body {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  background-color: #f6f6f6;
  overflow-x:hidden;
}

.nav {
  width: 100vw ;
  background-color: rgba(0, 0, 0, 0.75);
  height: 10vh;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 3fr 1fr;
  grid-gap: 1em;
  justify-content: center;
  align-items: center;
}

.logo {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-image {
  height: 10vh;
  width: auto;
}

ul {
  width: 100%;
  height: 80%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-gap: 5px;
  justify-content: center;
  align-items: center;
}

li {
  height: 100%;
  list-style: none;
  /* ============================center text ===================================*/
  display: flex;
  align-items: center;
  justify-content: center;
  /* ============================center text ===================================*/
}

li > a {
  color: white;
  text-decoration: none;
  font-size: 25px;
}

.order-button {
  height: 80%;
  color: white;
  font-size: 15px;
  text-align: center;
  text-decoration: none;
  /* ============================center text ===================================*/
  display: flex;
  align-items: center;
  justify-content: center;
  /* ============================center text ===================================*/
  transition: all 300ms;
  border-radius: 10px;
  background-color: #ff7e67;
}

.order-button:hover {

}

.header {
  height: 90vh;
  width: 100vw;
  background: url('https://images.pexels.com/photos/3758133/pexels-photo-3758133.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260') fixed;
  background-size: cover;
  background-position: center center;
}
.header-overlay {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, .75);
 /* ============================center text ===================================*/
  display: flex;
  align-items: center;
  justify-content: center;
  /* ============================center text ===================================*/   
}


.header-text {
  color: white;
  font-size: 100px;
  /* ============================center text ===================================*/
  display: flex;
  align-items: center;
  justify-content: center;
  /* ============================center text ===================================*/
}

.description {
  width: 60vw;
  height: 25vh;
  position: absolute;
  bottom: -12.5vh;
  left: 20vw;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-gap: 0.05px;
}

.disc-box {
  height: 100%;
  background-color: white;
  border: 1px solid gray;
}

.menu {
  width: 95vw;
  height: 75vh;
  background-color: black;
  margin-top: 120px;
}


.comment-1 {
  width: 100vw;
  height: 50vh;
  background: url('https://images.pexels.com/photos/1092730/pexels-photo-1092730.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260') fixed;
  background-size: cover;
  background-position: center center;
}

.gallery {
  height: auto;
  width: 95vw;
  background-color: white;
  display: grid;
  grid-template-columns: repeat(auto-fill, 585px);
  grid-gap: 30px;
  justify-content: space-evenly;
  margin: 20px;
}

.gallery-image {
  height: 50vh;
  overflow: hidden;
}

img {
  width: 100%;
}

.comment-2 {
  width: 100vw;
  height: 50vh;
  background: url('https://images.pexels.com/photos/3184306/pexels-photo-3184306.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260') fixed;
  background-size: cover;
  background-position: center center;
}

.contact {
  width: 95vw;
  height: 75vh;
  background-color: purple;
}

footer {
  height: 25vh;
  width: 100vw;
  background-color: #2c3e50;
}

.overlay {
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, .75);
  display: flex;
  align-items: center;
  /* Vertical center alignment */
  justify-content: center;
  /* Horizontal center alignment */
}

.comment-text {
  font-size: 70px;
  color: white;
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>restaurent</title>
    <link rel="stylesheet" href="style2.css" />

</head>

<body>
   <div class="nav">
      <div class="logo">
          <img src="https://imagizer.imageshack.com/img923/8324/VbQDbs.jpg" alt="" class="logo-image">
      </div>
      
      <ul>
          <li class="nav-link"><a href="">home</a></li>
          <li class="nav-link"><a href="">about us</a></li>
          <li class="nav-link"><a href="">home</a></li>
          <li class="nav-link"><a href="">contact us</a></li>
      </ul>
      
      <a href="#" class="order-button">
          <h1>button</h1>
      </a>
   </div>
   
   <div class="header">
      <div class="header-overlay">
        <h1 class="header-text">hello world</h1>
      </div>
      <div class="description"></div>
   </div>

   <div class="description">
      <div class="disc-box"></div>
      <div class="disc-box"></div>
      <div class="disc-box"></div>
   </div>
   
   <div class="menu"></div>
   
   <div class="comment-1">
      <div class="overlay">
          <h1 class="comment-text">hello world</h1>
      </div>
   </div>

   <div class="gallery">
      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/1581384/pexels-photo-1581384.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>

      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/1581384/pexels-photo-1581384.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>

      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/842142/pexels-photo-842142.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>
      
      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/2641886/pexels-photo-2641886.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>
      
      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/5938/food-salad-healthy-lunch.jpg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>

      <div class="gallery-image">
          <img src="https://images.pexels.com/photos/2159065/pexels-photo-2159065.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260" alt="#">
      </div>
      
    </div>
    
    <div class="comment-2">
        <div class="overlay">
            <h1 class="comment-text">hello world</h1>
        </div>
    </div>

    <div class="contact"></div>

    <footer></footer>

</body>

</html>

overflow-x:hidden;放在身体样式中
在您的代码中就是这样

body {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  background-color: #f6f6f6;
  overflow-x:hidden;
}