所以我正在为HTML编写我的最后一个项目,当格式化图片时,我不小心把它放得太右了,它水平地扩展了我的网页,现在我已经修复了图像,在右边有很多额外的空间。同样的事情也发生在垂直方向,但我只是将body标签的高度设置为100%,它会处理它,我尝试过使用width,但它只是缩小了我的内容,而不改变网页的物理大小。如果你们能提供任何帮助我将不胜感激。这是网页enter image description here的图片
以下是代码
<html>
<title> Bodybuilding </title>
<head>
<style>
.image1 {
z-index: -1;
}
.active {
background-color: #000000
}
.image2 {
position: absolute;
right: 26px;
top: 10px;
}
.title {
position: relative;
top: -250px;
border-style: solid;
border-color: #0E878A;
font-size: 49.5px;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
position: relative;
top: -245px;
background-color: #333;
border-top: 2px solid #bbb;
border-left: 2px solid #bbb;
border-bottom: 2px solid #bbb;
border-radius: 10px;
}
li {
float: left;
border-right: 2px solid #bbb;
}
li a {
display: inline;
color: #0E878A;
text-align: center;
padding: 15px;
text-decoration: none;
font-size: 35px;
}
li a:hover {
background-color: #111;
}
h2 {
position: relative;
top: -797px;
}
p {
position: relative;
top: -797px;
font-size: 30px;
}
.arnold {
position: relative;
left : 1130px;
top: -235px;
}
body {
background: linear-gradient(#939FA0,#41858B);
height: 100%;
width: 98.27%;
}
h3 {
position: relative;
top: -765px;
</style>
</head>
<div class="image1">
<img src="bbifbb.png" width="359" height="250">
</div>
<div class="image2">
<img src="bbphil.jpg" width="359" height="250">
</div>
<div class ="title">
<center>
<h1> Bodybuilding </h1>
</center>
</div>
<body bgcolor="#939FA0">
<body>
<ul>
<li><a class = "active" href="bbfinal.html">Home</a></li>
<li><a href="bbfamous.html">Famous Bodybuilders</a></li>
<li><a href="bbolympia.html">Mr. Olympia</a></li>
<li><a href="bbsteroids.html">Steroids</a></li>
<li><a href="bbmodern.html">Modern Bodybuilders</a></li>
<li><a href="bbcompetitions.html">Competitions</a></li>
<li><a href="bbimagemap.html">Find Competitions</a></li>
<li><a href="bbcontact.html">Contact Me</a></li>
</ul>
<div class ="arnold">
<img src="bbarnold.jpg">
</div>
https://stackoverflow.com/questions/50769223
复制相似问题