为什么我不应该在网站上显示滚动条?

鲍勃·罗斯

我正在建立一个不和谐服务器网站,以便人们找到不和谐服务器来加入并结交朋友,但是,我不知道为什么我的网页有水平滚动条。它也有一个垂直滚动条,它不应该有,这是我的HTML和CSS

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>OnTop Servers</title>
</head>
<body>
    <nav class="topnav">
        <div class="topnav-right">
        <a class="active" href="index.html">Home</a>
        <a href="search.html">Search</a>
        <a href="servers.html">Servers</a>
        </div>
         <h2 class="title">
            OnTop Servers
        </h2>
    </nav>
    <center>
        <div class="welcome">
            <div class="centered-text">
                <div class="welcome-body-inner">
                <h2 class="head">
                    DISCOVER
                    <span class="discord-logo">DISCORD</span>
                    SERVERS
                </h2>
                <h3 class="body">
                    Find amazing servers to interact with and make friends
                </h3>
                </div>
            </div>
        </div>
    </center>

    <footer>
        <div class="container">
            <div class="column">
                <ul class="footer-links">
                    <li>
                        <a class="link-text" href="index.html" title="Home">
                            Home </a>
                    </li>
                    <li>
                        <a class="link-text" href="search.html" title="Search"> 
                            Search </a>
                    </li>
                    <li>
                        <a class="link-text" href="servers.html" title="Servers"> 
                            Servers </a>
                    </li>
                    <li>
                        <a class="link-text" href="https://discord.gg/" target="_blank">
                            Official Discord Server </a>
                    </li>
                    <li>
                        <a class="link-text" href="termsofservice.html" target="_blank">
                            Terms Of Service </a>
                    </li>
                    <li>
                        <a class="link-text" href="guidelines.html" target="_blank">
                            Guidelines </a>
                    </li>
                </ul>
            </div>   
        </div>
        <div class="copyright"> 
            <p class="copyright-text">&copy; Copyright 2020 OnTop Servers</p>
            </div>
        </footer>
</body>
</html>

CSS:

  .row::after {
    clear: both;
    display: table;
  }

.copyright {
    position: absolute;
    bottom: 1%;
    right: 1%;
    font-size: 15px;
}

.copyright-text {
  color: white;
}

.footer-links {
  position: absolute;
  bottom: 5%;
}

.link-text {
  color: white;
  text-decoration: none;
}

.container {
  padding: 0;
  margin: 0;
}

li {
  list-style-type: none;
}

footer {
  position: absolute;
  bottom: 0%;
  clear: both;
  height: 200px;
  width: 1920px;
  color: #fff;
  background: #2c2c2c;
}

.welcome {
  margin-top: -2.5rem;
  width: 100%;
  height: 35.5rem;
  line-height: 1.8em;
  margin-bottom: .4em;
  padding: 0;
  font-family: Helvetica;
  font-weight: 600;
  font-size: 1.5em;
  color: #ffff;
  text-transform: uppercase;
}

.centered-text {
  position: relative;
  left: 24.5%;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.discord-logo {
  border: 0;
  font: 0/0 a;
  text-shadow: none;
  color: transparent;
  display: inline-block;
  padding: .6em 0;
  background: url(images/Discord-Wordmark-White.png) center no-repeat;
  background-size: contain;
  font-size: 1em;
}

.head {
  margin-bottom: .4em;
  padding: 0;
  line-height: 1.4;
  font-weight: 600;
  font-size: 2em;
}

.body {
  margin: 0 auto 1em;
  text-transform: inherit;
  opacity: 85%;
}

我该如何解决这个问题呢,它确实困扰着我,我无法弄清问题是什么?

阿罗奇

就是这个组合

position: relative;
left: 24.5%;
display: flex;

您有一个块级框,因此空白区域的宽度与容器的宽度相同,然后将其宽度的24.5%向右移动,使其右边缘与容器的左边缘相距124.5%。这总是会水平溢出容器。

我建议使用margin-left而不是left

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

为什么我们不应该在Java中使用受保护的静态

如果PyPy快6.3倍,为什么我不应该在CPython上使用PyPy?

为什么我不应该在继承中使用平等?

为什么我们不应该在py脚本中使用sys.setdefaultencoding(“ utf-8”)?

为什么我不应该在JNI中重用jclass和/或jmethodID?

为什么我不应该在PHP中使用mysql_ *函数?

为什么我不应该在Java8中的Optional上使用基于身份的操作?

为什么不应该在python中使用list.sort

为什么我不应该在Spout.nextTuple()中循环或阻止

为什么在我的网站上显示水平滚动条?

为什么我不应该在Angular 2的组件中提供服务

为什么不应该在财务交易中使用nosql

为什么我不应该在ARMv6 +的系统内存上使用ioremap?

什么时候(不应该)我应该在Android上测试UI组件?

为什么不应该在ES6中使用全部导入

为什么我不应该在React Redux中使用toJS()?(mapStateToProps)

为什么不应该在python中动态生成变量名?

为什么不应该在Symfony4的生产环境中加载.env?

为什么不应该在PHP中使用mysql_ *函数?

为什么我们不应该在同一层使用多个激活功能?

为什么我不应该在Android中使用System.out.println()

为什么我不应该在计算机机箱附近放置会产生静电的物品?

CountDownTimer为什么不应该在应有的时候启动onTick?

为什么不应该在cakePHP 3中调用虚拟属性获取器?

为什么有人不应该在命令行中使用密码?

为什么不应该在防火墙外部使用TCP绑定?

为什么我的函数返回零为什么它不应该在 R 中

为什么我们不应该在 ComponentDidMount 中设置状态

为什么错误消息不应该在 Go 中以标点符号结尾?