繁体   English   中英

网站内容溢出时,Cant不能向上滚动吗?

[英]When website content overflows, Cant scroll up?

除了代码外,没有什么要说的。 当分辨率足够小时,我无法向上滚动,东西溢出,并且我无法查看该东西。 虽然我可以向下滚动

我使用JavaScript分配是因为它是一种游戏。 它广泛发布的方式,但是如果您真的要告诉我

的HTML

<html>
<head>

</head>
<body>
    <canvas id="canvas">You're browser does not support the canvas tag. Go and get a real browser, nub</canvas>
    <div id="redSelector">
        <div class="genericButton" id="zombieRed">Zombie</div>
        <div class="genericButton" id="skeletonRed">Skeleton</div>
         <div class="genericButton" id="creeperRed">Creeper</div>
        <div class="genericButton" id="spideBlue">Spider</div>
    </div>
    <div id="blueSelector">
        <div class="genericButton" id="zombieBlue">Zombie</div>
        <div class="genericButton" id="skeletonBlue">Skeleton</div>
         <div class="genericButton" id="creeperBlue">Creeper</div>
        <div class="genericButton" id="spiderBlue">Spider</div>
    </div>
    <div id="options">

        <div class="lineContainer">
            <div class="heading" id="Options-heading">Insert Title Here</div>
        </div>
        <div class="lineContainer">
            <div class="text" id="Options-info">Welcome to Insert Title Here. This game is a strategic game with an scaled up<br>
                                                rock paper scissors concept. To beat you're opponent, You must select certain<br> 
                                                mobs that do good against you're opponents mobs. You can also make combinations<br> 
                                                of mobs to destroy you're opponents base but you must take into consideration <br>
                                                the prices. better mobs require more money and take up more population.</div>
        </div>
        <div class="lineContainer">
            <div id="Restart" class="options-button">Restart</div>
            <div id="Exit" class="options-button">Exit</div>
            <div id="Play" class="options-button">Play</div>
        </div>
        <div class="lineContainer">        
            <div id="Credits" class="options-button">Credits</div>
            <div id="Support" class="options-button">Contact</div>
            <div id="Controls" class="options-button">Controls</div>
        </div>
        <div class="lineContainer">
            <div id="CreditsInfo" class="options-tab">Made entirely by _____ ____</div>
            <div id="SupportInfo" class = "options-tab">Please tell me what you think and how I could improve. (Link)</div>
            <div id="ControlsInfo" class="options-tab">A-D to move player 1 scrollbar. J-L to move player 2 scrollbar. Hover over mob to see stats. Press O to pause.</div>
        </div>
    </div>
    <link rel="stylesheet" href="normalize.css">
    <link rel="stylesheet" href="main.css">
    <script src="jquery.js"></script>
    <script src="rectangle.js"></script>
    <script src="main.js"></script>
</body>

的CSS

html {
    overflow: -moz-scrollbars-horizontal;
    overflow-x: scroll;
    -webkit-user-select: none;
    -moz-user-select: none;
}

html, body {
  width:  100%;
  height: 100%;
  margin: 0px;
  background-color: rgb(50, 50, 50);  
}
#Options-info{
    display: inline-block;
    background-color: rgb(255, 153, 0);
    border: 2px solid black;
    padding: 5px 5px;
    margin: 5px;

}

#redSelector{
    position: absolute;
    top: 0px;
    left: 0px;
    width: 0px auto;
    height: 100px;
    background-color: red;
    margin: 0px auto;
    border: 2px solid black
}
#blueSelector{
    position: absolute;
    top: 0px ;
    left: 0px;
    width: 0px auto;
    height: 100px;
    background-color: blue;
    margin: 0px auto;
    border: 2px solid black;
}
.genericButton{ 
    position: relative;
    display: inline-block;
    background-color: green;
    width: 50;
    height: 75;
    margin: 10;
    border: 2px solid black
}
#canvas{
    border: 10px solid black;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    background-color: rgb(100, 100, 100);
}
#options{
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 80%;
    height: 650px;
    border: 10px solid black;
    background-color: rgb(200, 200, 200);
    margin: auto;
    text-align: center;
}

.options-button {
    display: inline-block;
    padding: 25px 25px;
    font-size: 30px;
    background-color: rgb(255, 153, 0);
    margin: 5px;
    width: 100px;
    cursor: pointer;
    border: 2px solid black;

}
.options-tab{
    display: none;
    padding: 15px 15px;
    font-size: 20px;
    width: 200px;
    border: 2px solid black;
    margin: 5px;
    background-color: rgb(0, 153, 255)
}
.options-button:hover {
    background-color: rgb(155, 103, 0)
}
.options-button:active{
    position: relative;
    top: 1;
}

.heading{
    font-size: 75px;
    display: inline-block;
    padding: 25px 25px;
    background-color: rgb(255, 153, 0);
    margin: 5px;
    border: 2px solid black;
}
.lineContainer{

}

您已使用绝对定位元素。 修复ID为“选项”并包含选项按钮的主容器。

更改:#options {位置:绝对; 最高:0; 底部:0 左:0; 正确:0; 宽度:80%; 高度:650px; 边框:10px纯黑色; background-color:rgb(200,200,200); 保证金:自动; 文本对齐:居中; }

到:#options {位置:相对; 宽度:80%; 高度:650px; 边框:10px纯黑色; background-color:rgb(200,200,200); 保证金:0自动; 文本对齐:居中; }

我还建议您将#options的height属性更改为auto,以便扩展容器的大小。

您很可能需要更改其他元素的位置以停止重叠。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM