我正在设计我的网页,想知道是否有人可以告诉我左侧的侧边栏是如何到达这里的以及如何在 CSS 中摆脱它
P粉741223880
P粉741223880 2024-02-03 23:55:27
0
2
314

<!doctype html>
<html>

    <head>
      
      <!--Font Link-->
      <link rel="preconnect" href="https://fonts.googleapis.com">
      <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
      <link href="https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap" rel="stylesheet">
      <!--CSS-->
      <link href="SQIStyle.css" rel="stylesheet" type="text/css">
      <title>Solarquake Studios</title>
      <!--favicon-->
      <link rel="icon" type="image/ico" sizes="128x128" href="Logo.ico"/>

      <style>


      </style>
      
    </head>

    <h1>SolarQuake Studios</h1>

    <header>
      <img src="Logo.ico" alt="logo" width="80" height="80">
    </header>
    
    <body>


      <div class="container">
           <div class="left-col">
               <div class="scroll-bg">
                    <div class="scroll-div">
                     <div class="scroll-object">
                      <h3><u>Games</u></h3>
                      <p>Upcoming Projects</p>
                      <p></p>
                     </div>
                   </div>
               </div>
    
           </div>

           <div class="center-col">
               <div class="scroll-bg">
                    <div class="scroll-div">
                     <div class="scroll-object">
                      <h3><u>Esports</u></h3>
                      <p>The Hog Pen</p>
                     </div>
                    </div>
              </div>
           </div>

           <div class="right-col">
               <div class="scroll-bg">
                    <div class="scroll-div">
                     <div class="scroll-object">
                      <h3><u>Assets</u></h3>
                      <p>Game Art & Designs</p>
                     </div>
                    </div>
               </div>
           </div>

      </div>

      <div class="footer">
        &copy; All Rights Reserved.

        <p class ="secondary">Follow Us!</p>

        <a href="https://www.youtube.com/channel/UChQzAj3OlDO3sqZl7frbY7g"><img src="YTLogo.png" 
         width="70" 
         height="70" 
         alt="logo"></a>

        <a href="https://twitter.com/SQdevelopers"><img src="Twitterlogo.png" 
         width="64" 
         height="64" 
         alt="logo"></a>

      </div>
      
    </body>

</html>

左侧的侧边栏本来就不应该出现在这里,我已经使用了这些列的容器以及scroll-Div、scroll-BG 和scroll-object 类,但没有取得任何进展。这是到目前为止我所有的 CSS 代码。提前致谢。

h1 {
    font-size: 40px;
    line-height: 62px;
    font-family: 'Press Start 2P', cursive;
    text-align: center;
    color: yellow;
    
}

h2 {

    font-size: 40px;
    color: white;
    font-family: 'Press Start 2P', cursive;

}

h3 {

    color: white;

}

header {

    text-align: center;
    padding-bottom: 10px;
}



.container div {
    
    box-sizing: border-box;
    min-height: 250px;
    margin-left: 6.5%;

}

.left-col {
    
    width: 25%;
    float: left;
    text-align: center;
    color: floralwhite;   
    

}

.right-col {

    width: 25%;
    float: left;
    text-align: center;
    color: floralwhite;

}

.center-col {

    width: 25%;
    float: left;
    text-align: center;
    color: floralwhite;
    
}

.footer {

     clear: both;
     text-align: center;
     box-sizing: border-box;
     padding-top: 5px;
     color: yellow;
     font-size: 7px;

}


body {

    font-size: 20px;
    font-family: 'Press Start 2P', cursive;
    background-color: white;
    background-image: url("Space.png");

}

.scroll-bg {

    background-color: yellow;
    width: 375px;
    margin: 10% auto;
    text-align: center;
    

}

.scroll-div {
    
    background: rgb(0, 0, 0);
    height: 400px;
    overflow: hidden;
    overflow-y: scroll;
    text-align: center;

}

.scroll-object {

    color: white;
    font-family: 'Press Start 2P', cursive;
    font-size: 15px;
    text-align: center;
    
}

我试图删除左侧的侧边栏,它是黄色的。我在代码中找不到它的来源。在此处输入图像描述

P粉741223880
P粉741223880

全部回复(2)
P粉449281068

真是一团糟。

您将左侧的每个 div 的边距设置为 6.5%。 将 .container div(意味着容器内的每个 div 都会有 6.5% 的边距)更改为 .container 并删除边距。并在每个 col 类中添加左右边距。

P粉347804896

黄色侧边栏在那里是因为你有一个带有 class="scroll-bg" 的 div 因此,从 css 中删除scroll-bg 部分,并从 html 中删除它的引用。

### Remove ####
.scroll-bg {
    background-color: yellow;
    width: 375px;
    margin: 10% auto;
    text-align: center;
}

工作示例 - https://jsbin.com/wubuqolumo/edit?html, CSS,输出

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!