gpt4 book ai didi

html - html/css 网站上的缩放问题

转载 作者:行者123 更新时间:2023-11-28 17:14:16 25 4
gpt4 key购买 nike

所以过去两天我和我的 friend 一起尝试制作这个网站。每个人都进展顺利,我们从这里得到了很多帮助。尽管我们在网站缩放方面遇到了问题。当我们的网站处于全屏模式时,一切正常,但如果您打开窗口使其仅覆盖显示器的一半,则网站下方会出现一个白色 block 。你可以在这里明白我的意思:https://gyazo.com/103cf6b312512a2ce9fdac7e23788fdf谢谢

 <style>
.Button {
background-color: Plum;
border: 1px solid;
border-color: black;
color: white;
padding: 10px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-family: hacked;
border-radius: 8px;
text-shadow: 2px 2px grey;


}

.sub {
position: relative;
}
.itmHolder {
position: relative;
}



.itmHolder:nth-child(2),
.itmHolder:nth-child(3) {
position: absolute;
top: 0;
}
.og {
margin-top: 50px;
position: center;
text-align: center;
}

h1 {
font-size: 400%;
color: Plum;
text-shadow: 4px 4px Black;
}
body {
background-image: url("lightning.gif");
background-repeat: no-repeat;
-webkit-transform: rotateX(0);
background-size: cover;
background-position: center center;
}

a:link, a:visited {
color: black;
text-align: center;
text-decoration: none;
display: inline-block;
}


</style>
<!DOCTYPE html>
<html>
<head>
<title>Our Future</title>
</head>

<body background="lightning.gif">

<embed name="myMusic" loop="true" hidden="true" src="thunder.mp3"></embed>


<center><h1 style="font-family:blowbrush;">Future</center></h1><form action="side2.html">


<div class="og">
<div class="itmHolder">

<div class="sub">
<button type="button" class="Button"><a href="side2.html">About us</a></button>
<button type="button" class="Button"><a href="buynow.html">Buy now</a></button>
</div>



<br></br>
</body>
</html>
<picture>
<!--Billede-->
<br></br>
<br></br>
<center><img src="ourfuture.png" alt="Matrix" width="700" height="400" border="5"><center/>
<br></br>
<br></br>
</picture>

最佳答案

min-height: 100vh 添加到 body 中,如果内容比浏览器视口(viewport)短,它会延伸到窗口底部。您还可以添加 margin: 0,这样如果浏览器高于内容,默认边距不会使窗口垂直滚动。

 <style>
.Button {
background-color: Plum;
border: 1px solid;
border-color: black;
color: white;
padding: 10px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-family: hacked;
border-radius: 8px;
text-shadow: 2px 2px grey;


}

.sub {
position: relative;
}
.itmHolder {
position: relative;
}



.itmHolder:nth-child(2),
.itmHolder:nth-child(3) {
position: absolute;
top: 0;
}
.og {
margin-top: 50px;
position: center;
text-align: center;
}

h1 {
font-size: 400%;
color: Plum;
text-shadow: 4px 4px Black;
}
body {
background-image: url("http://cdn.thedailybeast.com/content/dailybeast/articles/2015/03/31/neil-degrasse-tyson-defends-scientology-and-the-bush-administration-s-science-record/jcr:content/image.img.2000.jpg/1432067001553.cached.jpg");
background-repeat: no-repeat;
-webkit-transform: rotateX(0);
background-size: cover;
background-position: center center;
min-height: 100vh;
}

a:link, a:visited {
color: black;
text-align: center;
text-decoration: none;
display: inline-block;
}


</style>
<!DOCTYPE html>
<html>
<head>
<title>Our Future</title>
</head>

<body background="lightning.gif">

<embed name="myMusic" loop="true" hidden="true" src="thunder.mp3"></embed>


<center><h1 style="font-family:blowbrush;">Future</center></h1><form action="side2.html">


<div class="og">
<div class="itmHolder">

<div class="sub">
<button type="button" class="Button"><a href="side2.html">About us</a></button>
<button type="button" class="Button"><a href="buynow.html">Buy now</a></button>
</div>



<br></br>
</body>
</html>
<picture>
<!--Billede-->
<br></br>
<br></br>
<center><img src="ourfuture.png" alt="Matrix" width="700" height="400" border="5"><center/>
<br></br>
<br></br>
</picture>

关于html - html/css 网站上的缩放问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44663362/

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