页脚未覆盖页面宽度的 100%

问题描述 投票:0回答:1

我有一个带有以下页脚代码的页面

.footer {
display: flex;
align-items: center;
width: 100%;
margin: 0;
height: 100%;
background-color: black;
color: bisque;
font-size: 20px;
}

我知道大多数人不使用“高度:100%”,但我认为(不确定)这不是问题的一部分,问题是,它覆盖了 100% 的屏幕尺寸,但不是我网站的所有元素根据屏幕尺寸,将覆盖 100% 的屏幕尺寸,并且会导致水平溢出,每当出现水平溢出时,我的页脚不会覆盖溢出的部分,导致滚动时显示一些空白屏幕水平。

我有一些疑问,我是否需要以任何屏幕尺寸都不会水平溢出的方式对我的网站进行编程?是否推荐或可以在任何网站上使用?另外,有没有办法让我的页脚也覆盖溢出的区域?

这是完整的html

<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <title>Sobre nós</title>
    <link rel="stylesheet" href="style.css">
</head>
<body class="about_me">
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v17.0" nonce="Aw1TIrLL"></script>
<nav>
    <div class="nav-content">
    <img src="img/logo-3.png" class="nav-logo" >
    <ul>
      <li><a href="index.html">Página inicial</a></li>
      <li class="has-submenu">
        <a href="#">Sobre</a>
        <ul class="sub-menu">
          <li><a href="about_me.html" target="_blank" >Sobre mim</a></li>
          <li><a href="about_us.html" target="_blank">Sobre nós</a></li>
        </ul>
      </li>
    
      <li class="has-submenu">
        <a href="#">Serviços</a>
        <ul class="sub-menu">
          <li><a href="#">Começar um projeto</a></li>
          <li><a href="#">Limpeza de PC</a></li>
        </ul>
      </li>
      <li><a href="#">Contato</a></li>
    </ul>
    <div class="fb-tt-buttons">
      <div class="tt-button">
        <a href="https://twitter.com/sryazigi?ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-screen-name="false" data-lang="pt" data-dnt="true" data-show-count="false"></a>
        <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
      </div>
      <div class="fb-like" data-href="https://www.facebook.com/profile.php?id=100094330637469" data-width="50" data-layout="button" data-action="like" data-size="small" data-share=""></div>
    </div>
    </div>
      <div class="sandwich-icon" onclick="toggleMenu()">
        &#9776; 
      </div>
      <div class="sandwich-menu">
        <ul>
          <li><a href="#">Página inicial</a></li>
          <li class="has-submenu">
            <a href="#">Sobre</a>
            <ul class="sub-menu">
              <li><a href="about_me.html">Sobre mim</a></li>
              <li><a href="#">Sobre nós</a></li>
            </ul>
          </li>
          <li class="has-submenu">
            <a href="#">Serviços</a>
            <ul class="sub-menu">
              <li><a href="#">Criação de websites</a></li>
              <li><a href="#">Limpeza de PC</a></li>
            </ul>
          </li>
          <li><a href="#">Contato</a></li>
        </ul> 
      </div>
  </nav>
  <br><br><br><br>
  <div class="about-us-container">
  <h2 class="orange"> Yazigi Tech: desde 2023 transformando idéias e sonhos em sistemas rentáveis! </h2>
mais do que um sistema web para seu negócio, a Yazigi Tech batalha para assegurar que o contratante tenha em mãos um site escalável, com uma boa infraestrutura de segurança, e que possa satisfazer todas as expectativas do cliente, nosso foco é na perfeição entre o sistema, e o que o cliente espera que será o sistema, com entrevistas, protótipos, e aprimoração de seu website, pode ter certeza que a Yazigi Tech é a empresa certa para quem busca insights, segurança e rentabilidade em seus negócios.<br>

<h2 class="orange">Garantia com a empresa</h2> após a finalização de seu sistema web, a Yazigi Tech pelo período de 1 mês, prestará auxílio na manutenção do website caso sejam encontrados bugs, problemas no funcionamento e problemas técnicos.<br>

<h2 class="orange">Qualidade na segurança</h2> em nosso sistema todas as senhas de acesso são devidamente criptografadas e a lei de proteção geral de dados (LGPD) é respeitada, nossos sistemas são pensados de maneira à evitar invasões e promover um ambiente seguro.<br>

<h2 class="orange">Preocupação com a qualidade</h2>Aprendizado é o alicerce de nosso sucesso. Em um mundo tecnológico em constante evolução, estamos empenhados em manter nossas equipes atualizadas com as mais recentes tendências e ferramentas. Investimos continuamente em programas de treinamento e desenvolvimento para garantir que nossos desenvolvedores estejam sempre na vanguarda da inovação.<br>

Não estamos apenas focados no crescimento quantitativo. Nosso compromisso é com a qualidade, não apenas em nosso código, mas também em nossos relacionamentos com os clientes. Buscamos entender profundamente as necessidades e desafios de nossos clientes e, em parceria com eles, entregamos soluções que atendem suas expectativas.<br>
<img src="img/happy-it-worker.png">
<a href=#><h3 class="orange"><u> Faça você também parte da nossa história</u></h3></a>

<br><b>Victor Yazigi | Tecnologia e inovação</b>


  </div> 
  
<br><br><br><br><br><br><br><br>

  <div class="footer">
    <img src="img/logo-3.png" alt="Minha logo" class="footer-logo">
    <div class="footer-info">
      Yazigi Tech software e manutenção de computadores<br>
      Editor da página: Victor Yazigi<br>
      Designer da página: Sabrina Leonel
    </div>
  </div>
</body>

</html>

以及完整的CSS

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;900&display=swap');

html, body {
  font-family: "Roboto", sans-serif;
  font-size: 16px;
  margin: 0;
  padding: 0;
}

.about_me {
  font-family: "Roboto", sans-serif;
  font-size: 16px;
  margin: 0;
  padding: 0;
}

.flex-container {
  display: flex;
  margin-top: 50px;
  justify-content:left;
  width: max-content;
  height: 100%;
}

.main-content-wrapper-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: calc(100vh - 250px);
}
a {
  color: white;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
}

nav {
  position: fixed;
  top: 0;
  width: 100%;
  height: 75px;
  z-index: 100;
  text-transform: capitalize;
  background-color: black;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding-right:3.5rem; /* Increase the padding on the left and right */
}

.nav-logo {
  position:relative;
  float:left;
  overflow: hidden;
  transform: translateY(-5%);
  width: 9.375rem;
  height:9.375rem;
}

nav ul {
  list-style: none;
  margin-left: 0;
  margin-right: 4rem; /* Add some right margin */
  padding: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-grow: 1;
}

nav li {
  flex: 1;
  position: relative;
}

.sandwich-icon {
  display: none;
}

.sandwich-menu {
    display: none;
    flex-direction: row-reverse;
    background-color: red;
    position: absolute;
    top: 9vh;
    left: 0;
    height: 100vh;
    z-index: 9999999999999;
}

@media screen and (max-width: 930px) {
 
  .nav-content{
    display: none;
  }

  .sandwich-icon {
    display: block;
    color: white;
    cursor: pointer;
    width: fit-content;
  }

  .sandwich-menu .show-menu ul {
    list-style: none;
    margin:0 10rem;
    padding: 0;
    padding: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    position: relative;
  }
  .sandwich-menu .show-menu {
    position: fixed;
    top: 0;
    width: 100%;
    height: 9vh;
    min-height: 3.5rem;
    z-index: 100;
    text-transform: capitalize;
    background-color: black;
  }
}

nav a {
  display: flex;
  align-items: center;
  justify-content: center; /* Center horizontally */
  text-decoration: none;
  transition: background-color 0.3s ease;
  height: 75px;
}

  nav a:hover {
    background-color: #FF7415;
}
  nav .has-submenu {
    position: relative;
  }

  nav .has-submenu .sub-menu {
    display: none;
    position: absolute;
    width: 100%;
    height: 100%;
    margin-left: 0;
    margin-right: 0;
    background-color: black;
    white-space: nowrap;
  }
  
  nav .has-submenu:hover .sub-menu {
    display: block;
    position: absolute;
  }

  nav .has-submenu:hover .sub-menu a {
    background-color: black;
    transition: background-color 0.3s ease;
  }
  
  nav .has-submenu .sub-menu a:hover {
    background-color: #FF7415;
  }

  nav ul li {
    position: relative;
  }

  nav ul li:hover .sub-menu {
    display: block;
  }

  nav .has-submenu:after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0.625rem;
    transform: translateY(-50%) rotate(-45deg);
    border: solid white;
    border-width: 0 0.0625rem 0.0625rem 0;
    display: inline-block;
    padding: 0.1875rem;
    pointer-events: none;
    transition: transform 0.3s ease;
  }
  
  nav .has-submenu:hover:after {
    transform: translateY(-50%) rotate(45deg);
  }

  .fb-tt-buttons {
    position: absolute;
    display: flex;
    flex-direction: column; /* Set flex-direction to column for vertical alignment */
    align-items: flex-end; /* Align buttons to the right side of the container */
    margin: 0;
    padding: 0;
    right: 1%; /* Adjust the right position */
    bottom: 0.5rem;
  }

  .tt-button{
    transform: translateX(-10%);
  }

.homepage-text-large {
  font-family: "Lato", sans-serif;
  padding-top: 30px;
  margin-left: 30px;
  font-weight: 900;
  font-size: 50.6px;
  text-transform: uppercase;
  margin-top: 56px;
  line-height: 50px;
}

.homepage-text-large .first-line {
  text-transform:none;
}

.homepage-text-large-orange {
  color:#FF7415;
}

.homepage-text-medium {
  margin-top: 10px;
  margin-bottom: 0.3125rem;
  font-weight:500;
  font-size: 28px;
  line-height: 30px;
}

.homepage-text-small {
  margin-bottom: 50px;
  font-size: 15.7px;
  font-weight: 1;
  line-height: 15px;
  text-align: center;
  display: inline-block;
  text-transform: none;
}

.computer-boy {
  margin-top: 1%;
  transform: translateX(-13%);
  top: 2%;
  width: 1000px;
  height: 547px;
}

.clear {
  clear: both;
  width: fit-content;
}

.home-main-buttons {  
  align-items: center;
  margin-inline:1rem;
  appearance: none;
  background-color: #FF7415;
  border-radius: 0.5rem;
  border-width: 0;
  box-shadow: rgba(45, 35, 66, 0.4) 0 2px 4px,rgba(45, 35, 66, 0.3) 0 7px 13px -3px,rgba(255, 116, 21) 0 -3px 0 inset;
  box-sizing: border-box;
  color: WHITE;
  cursor: pointer;
  display: inline-flex;
  width: 11.875rem;
  height: 3.75rem;
  justify-content: center;
  line-height: 1;
  list-style: none;
  overflow: hidden;
  padding-left: 1rem;
  padding-right: 1rem;
  position: relative;
  text-align: left;
  text-decoration: none;
  transition: box-shadow .15s,transform .15s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  white-space: nowrap;
  will-change: box-shadow,transform;
  font-size: 18px;
}

.home-main-buttons:focus {
  box-shadow: rgba(255, 116, 21) 0 0 0 1.5px inset, rgba(45, 35, 66, 0.4) 0 2px 4px, rgba(45, 35, 66, 0.3) 0 7px 13px -3px, rgba(255, 116, 21) 0 -3px 0 inset;
}

.home-main-buttons:hover {
  box-shadow: rgba(31, 28, 37, 0.4) 0 4px 8px, rgba(45, 35, 66, 0.3) 0 7px 13px -3px, rgba(255, 116, 21) 0 -3px 0 inset;
  transform: translateY(-2px);
}

.home-main-buttons:active {
  box-shadow: rgba(255, 116, 21) 0 3px 7px inset;
  transform: translateY(2px);
}

.footer {
display: flex;
align-items: center;
width: 100%;
margin: 0;
height: 100%;
background-color: black;
color: bisque;
font-size: 20px;
}

.footer-logo {
  position: relative;
  margin-right: 1rem;
  width:12.5rem;
  height:12.5rem;
  overflow: hidden;
}

.footer-info {
  position:relative;
  overflow: hidden;
  flex-grow: 1;
}

.white-border-bot {
  border-bottom: 2px solid white;
}

.white-border-top {
  border-top: 1px solid white;
}

.white-border-sides{
  border-left: 2px solid white;
  border-right: 2px solid white;
}

.pumpkin-orange {
  color:#FF7415;
}

.inline {
  display: inline;
}

.white-background{
  background-color: white;
}

.computer-hacker {
  display: flex;
  align-items: center;
  min-width: 120px;
}

.about-me-container {
  position: relative;
  display: flex;
  flex-direction: column;
  right: 250px;
  min-width: 500px;
  top: 9.375rem;
}

.presentation-gif {
  position: relative;
  left: 10rem;
  bottom: 40px;
}

.ability-table {
  position: relative;
  width: 91%;
  margin-top: 3.5rem;
  right: 7%;
  left: 2%;
}

.ability-table td{
  border: 2px solid black;
}

.table-title {
  font-weight: bold;
  font-size: 1.5em;
}

.center-stuff {
  text-align: center;
}

.hello {
  position: relative;
  display: flex;
  flex-direction: row;
  left: 7rem;
  min-width: 345px;
  max-height: 50px;
  top:3.125rem;
}

.certificate-1{
  position: relative;
  margin-top: 3rem;
  left: 40px;
}

.certificate-2{
  position: relative;
  margin-top: 3rem;
  right: 175px;
}

.flex-container-about-me {
  display: flex;
}

.about-us-container {
  position: relative;
  width: 1100px;
  right: 20%;
  left: 20%;
  top:5rem;
  padding: 10px;
  letter-spacing: 1px;
  line-height: 1.5;
}

.orange {
  color:#FF7415;
}

我尝试过多次更改,但似乎没有效果。 除了页脚之外,我的代码是否还有其他响应问题?我正在努力做到100%

html css responsive-design width footer
1个回答
0
投票

错误的可能根源:

footer
类没有像您的
nav
元素那样占据文档的整个宽度的原因是因为(1)
nav
元素具有
absolute
位置(2)
about-us-container
类具有属性
right
left
以及各自的值
20%
,这会将您的内容呈现在
footer
类的宽度之外。

可能的解决方案:(1)省略

position
类上具有
relative
值的
about-us-container
属性和
position
元素上具有
absolute
值的
nav
属性 - 它们会影响流程布局以不必要的方式实现您的表面意图。 (2) 省略
left
类上的
right
about-us-container
属性,转而采用常见的居中方法:
margin: 0 auto

© www.soinside.com 2019 - 2024. All rights reserved.