首页 > 解决方案 > 如何在此页脚 HTML 中并排显示列表和 div

问题描述

我试图在它旁边做一个列表,一个链接到其他网站的图像,但它显示在它下面,我不知道为什么。我使用了正确的浮动,但仍然出现在它下面我奇怪的方式,因为它有宽度或阻止它显示的东西,所以任何帮助。我是前端世界的新手。

* {
  box-sizing: border-box;
}

.row {
  width: 100%;
}

header {
  width: 100%;
  height: 80px;
}

header p {
  text-align: center;
  text-decoration: black;
  font-weight: 1000;
  font-size: 20px;
  margin-top: 0 auto;
  display: block;
  font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

header nav ul {
  display: block;
  margin: 0 auto 0;
  width: fit-content;
}

header nav ul li a {
  text-decoration: none;
  color: black;
  margin-top: 0%;
  padding: 0 25px 25px 0;
  font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}

header nav ul li {
  list-style: none;
  display: inline-block;
  float: left;
}

main #banner {
  width: 100%;
  background-color: lavender;
  background-image: url("h.jpg");
  height: 600px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

main h2 {
  text-align: center;
  font-weight: 600;
  margin: 0%;
  text-shadow: 2px 2px 5px;
  color: blue;
  padding-top: 10px;
  font-size: 50px;
  font-weight: bold;
}

main p {
  text-align: center;
  overflow: hidden;
  font-size: 30px;
  font-style: italic;
  color: blue;
}

main #mainn {
  height: 400px;
}

main .buttons {
  background-color: grey;
  text-align: center;
  line-height: 100px;
  margin: 10px 0 0 0;
  color: black;
  font-weight: bold;
  box-shadow: 0 3px 3px 0 gainsboro;
}

footer {
  width: calc(100%-80px);
  overflow: hidden;
  background-color: grey;
  padding: 40px 40px;
  margin-top: 20%;
}

footer ul {
  color: white;
  width: fit-content;
  list-style: none;
}

footer ul li {
  display: block;
  list-style: none;
}

footer ul li a {
  text-decoration: none;
  line-height: 50px;
  color: white;
}

footer #second {
  display: none;
}

footer div {
  width: 60px;
  display: block;
  padding: 2em;
  margin-left: 20%;
  float: right;
}

footer div img {
  display: block;
  width: 40px;
  margin-bottom: 10px;
}


/**Desktop**/

@media (min-width: 992px) {
  .col-lg-1 {
    float: left;
  }
  .col-lg-1 {
    width: 33.33%;
  }
}


/**Taplets**/

@media (min-width: 768px) and (max-width: 991px) {
  .col-md-1 {
    float: left;
  }
  .col-md-1 {
    width: 50%;
  }
}


/**Mobile**/

@media (max-width: 767) {
  .col-sm-1 {
    float: left;
  }
  .col-sm-1 {
    width: 100%;
  }
}
<header class="row">
  <p>FirstProject</p>
  <nav>
    <ul>
      <li>
        <a href="ass.html">Home</a>
      </li>
      <li>
        <a href="seccond.html">Contact us</a>
      </li>
      <li>
        <a href="first.html">About</a>
      </li>
    </ul>
  </nav>
</header>
<main>

  <section id="banner">
    <h2>
      IAM A STRONG WEB DEVELOPER <br>WITH ALOT OF SKILLS
    </h2>
    <p>
      jasdslfsdjnksknglkgrlerkgne<br>kgnekgneklgnlkgnelkgneklgnkgsfmf<br>slfmsfgfgrgsrtytyyuoukjfbd
    </p>
  </section>

  <section id="mainn">
    <p class="buttons"> Cases </p>
    <p class="buttons"> Portfolio </p>
    <p class="buttons"> youtube </p>
    <p class="buttons"> behance </p>

  </section>
</main>

<footer>
  <ul id="first">
    <li>
      <a href="ass.html">Home</a>
    </li>
    <li>
      <a href="seccond.html">Contact us</a>
    </li>
    <li>
      <a href="first.html">About</a>
    </li>
  </ul>

  <ul id="second">
    <li>
      <a href="ass.html">Home</a>
    </li>
    <li>
      <a href="seccond.html">Contact us</a>
    </li>
    <li>
      <a href="first.html">About</a>
    </li>
  </ul>

  <div>
    <a href="https://www.facebook.com/">
      <img src="ab.png">
    </a>
    <a href="https://www.youtube.com/">
      <img src="bc.png">
    </a>
    <a href="https://translate.google.com/?">
      <img src="cd.png">
    </a>
  </div>

</footer>

参考图像 问题

标签: htmlcss

解决方案


试试显示:flex; 和边距:自动;命令


推荐阅读