国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Ich kann nichts auf dem Bildschirm zentrieren
P粉136356287
P粉136356287 2024-04-01 11:51:40
0
2
568

Ich folge einem YouTube-Tutorial darüber, wie man mit CSS eine responsive Navigationsleiste in HTML erstellt, und alles lief gut, bis ich versuchte, Text in der Mitte des Bildschirms hinzuzufügen, und dieser auf der linken Seite des Bildschirms erschien (nur wenn der Die Fensteraufl?sung ist h?her als 952 Pixel (Breite Stunde). Ich bin CSS-Neuling und alles, was ich zu beheben versuche, scheint nicht zu funktionieren. Der Code lautet wie folgt

* {
  padding: 0;
  margin: 0;
  text-decoration: none;
  list-style: none;
  box-sizing: border-box;
}

body {
  font-family: montserrat;
}

nav {
  background: #0082e6;
  height: 80px;
  width: 100%;
}

label.logo {
  color: white;
  font-size: 35px;
  line-height: 80px;
  padding: 100px;
  font-weight: bold;
}

nav ul {
  float: right;
  margin-right: 20px;
}

nav ul li {
  display: inline-block;
  line-height: 80px;
  margin: 0 5px;
}

nav ul li a {
  color: white;
  font-size: 17px;
  padding: 7px 13px;
  border-radius: 3px;
  text-transform: uppercase;
}

a.active,
a:hover {
  background: #1b9bff;
  transition: .5s;
}

.checkbtn {
  font-size: 30px;
  color: white;
  float: right;
  line-height: 80px;
  margin-right: 40px;
  cursor: pointer;
  display: none;
}

#check {
  display: none;
}

@media (max-width: 952px) {
  label.logo {
    font-size: 30px;
    padding-left: 50px;
  }
  nav ul li a {
    font-size: 16px;
  }
}

@media (max-width: 858px) {
  .checkbtn {
    display: block;
  }
  ul {
    position: fixed;
    width: 100%;
    height: 100vh;
    background: #2c3e50;
    top: 80px;
    left: -100%;
    text-align: center;
    transition: all .5s;
  }
  nav ul li {
    display: block;
  }
  nav ul li a {
    font-size: 20px;
  }
  a:hover,
  a.active {
    background: none;
    color: #0082e6;
  }
  #check:checked~ul {
    left: 0;
  }
}

section {
  background: url(bg1.jpeg) no-repeat;
  background-size: cover;
  height: calc(100vh - 80px);
  opacity: 20%;
}
<link rel="stylesheet" >
<meta charset="utf-8">
<meta name="viewport" content="width=device-widht,initial-sclae=1.0">
<link rel="stylesheet" href="style.css">
<script src="https://kit.fontawesome.com/.js" crossorigin="anonymous"></script>
<nav>
  <input type="checkbox" id="check">
  <label for="check" class="checkbtn">
                <i class="fas fa-bars"></i>
            </label>
  <label class="logo">Air</label>
  <ul>
    <li><a href='home.html'>Home</a></li>
    <li><a href='About.html'>About</a></li>
    <li><a href='Flights.html'>Flights</a></li>
    <li><a href='Contact.html'>Contact</a></li>
  </ul>
</nav>
<section>
  <h1 style="text-align:center;">test</h1>
</section>

P粉136356287
P粉136356287

Antworte allen(2)
P粉966979765

這解決了問題:將寬度設(shè)置為僅文本的寬度,然后通過 margin 0 auto 將容器對齊到中心。

test

P粉216203545

添加 section { 邊框:1px 實心透明; } 也解決了這個問題。

請參閱下面的代碼片段。

* {
  padding: 0;
  margin: 0;
  text-decoration: none;
  list-style: none;
  box-sizing: border-box;
}

body {
  font-family: montserrat;
}

nav {
  background: #0082e6;
  height: 80px;
  width: 100%;
}

label.logo {
  color: white;
  font-size: 35px;
  line-height: 80px;
  padding: 100px;
  font-weight: bold;
}

nav ul {
  float: right;
  margin-right: 20px;
}

nav ul li {
  display: inline-block;
  line-height: 80px;
  margin: 0 5px;
}

nav ul li a {
  color: white;
  font-size: 17px;
  padding: 7px 13px;
  border-radius: 3px;
  text-transform: uppercase;
}

a.active,
a:hover {
  background: #1b9bff;
  transition: .5s;
}

.checkbtn {
  font-size: 30px;
  color: white;
  float: right;
  line-height: 80px;
  margin-right: 40px;
  cursor: pointer;
  display: none;
}

#check {
  display: none;
}

@media (max-width: 952px) {
  label.logo {
    font-size: 30px;
    padding-left: 50px;
  }
  nav ul li a {
    font-size: 16px;
  }
}

@media (max-width: 858px) {
  .checkbtn {
    display: block;
  }
  ul {
    position: fixed;
    width: 100%;
    height: 100vh;
    background: #2c3e50;
    top: 80px;
    left: -100%;
    text-align: center;
    transition: all .5s;
  }
  nav ul li {
    display: block;
  }
  nav ul li a {
    font-size: 20px;
  }
  a:hover,
  a.active {
    background: none;
    color: #0082e6;
  }
  #check:checked~ul {
    left: 0;
  }
}

section {
  background: url(bg1.jpeg) no-repeat;
  background-size: cover;
  height: calc(100vh - 80px);
  opacity: 20%;
  border: 1px solid transparent;
}



  
  
  
    Air
  
  
  
  



  
  

test

Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage