gpt4 book ai didi

html - 如何让HTML页面适合屏幕?

转载 作者:太空宇宙 更新时间:2023-11-04 04:10:45 25 4
gpt4 key购买 nike

我正在设计一个使用 html 和 css 的网页,我制作了一个包含所有页面并由其他 div 组成的 div(像往常一样),但是当运行该页面时,它的高度大约是浏览器高度的 150% :

enter image description here

和包含所有页面的 div:

#items {
position: absolute;
width: 100%;
height: 100%;
z-index: 1;
left: 0px;
top: 0px;
}

和 html 代码:

<div id="items">
<select id="heap" class="basic-example"></select>
<img src="img/bg.png" class="responsive-image">

<div id="dummy"></div>

<div id="gallery">

</div>

<span id="order_list">
<img src="img/ItemList.png" class="responsive-image">
<div id="confirm" class="buttonClass">
<div align="center">Confirm</div>
</div>

<div id="total" class="totalClass">
<div align="center"></div>
</div>
</span>

</div>

最佳答案

这是你的问题:

您的内部容器位置低于 0,但高度为 100%。你看到的溢出部分是从你的位置 top:35px 开始的 35px。

#items {
position: absolute;
width: 100%;
/*height: 100%;*/ /* removed */
bottom:0; /* added */
z-index: 1;
left: 0px;
top: 0px;
}
#gallery {
position: absolute;
width: 75%;
/*height: 100%;*/ /* removed */
bottom:0; /* added */
z-index: 1;
top: 35px;
}
#order_list {
position: absolute;
width: 25%;
/*height: 100%;*/ /* removed */
bottom:0; /* added */
z-index: 2;
left: 75%;
top: 35px;
color: #F33;
background:url(img/ItemList.png) display: inline-block;
alignment-adjust: central;
font: Arial, Helvetica, sans-serif;
font-size: 14px;
font-size-adjust: inherit;
grid-rows: inherit;
list-style: upper-alpha;
word-spacing: inherit;
word-wrap: break-word;
vertical-align: central;
}

You jsfiddle with height:100%; removed and bottom:0; added

关于html - 如何让HTML页面适合屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20724141/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com