gpt4 book ai didi

html - 网站左侧的空白

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

这是 html:

html{
min-height: 100%;
}
body{
min-height: 100%;
}
.header {
background: url("bghero.png") no-repeat;
background-repeat: no-repeat;
background-size: cover;
background-position: center;
font-family: Montserrat;
height: 200%;
width: 100%;
font-size: 70%;
}
#circle{
text-align: center;
position: absolute;
left: 2%;
top: 4%;
}
#big{
text-align: center;
position: absolute;
font-family: Times New Roman;
font-size: 700%;
top: 40%;
color: white;
right: 0%;
width: 100%;

}
#sml{

}
#ham{
text-align: center-right;
position: absolute;
top: 6%;
right:5%;
}
#src{
text-align: center-right;
position: absolute;
top: 5.8%;
right:11%;
}
#menu1{
text-align: center;
color: white;
right: 6%;
position: absolute;
top: 5.3%;
width: 100%;
margin: 0%;
}
#menu2{
text-align: center;
color: white;
right: 0%;
top: 5.3%;
width: 100%;
margin: 0%;
position: absolute;
}
#menu3{
text-align: center;
color: white;
position: absolute;
right: -6%;
top: 5.3%;
width: 100%;
margin: 0%;
}

#lowerfoto{
height: 40%;
width: 100%;
=}
#fteweit{
height: 40%;
width: 100%;
}
#fterblk{
height: 10%;
width: 100%;
}
<div class="header">
<div class="background">
<img id="circle" src="circle.png" />
<div class="menu">
<a href="#">
<p id="menu1">Home</p>
</a>
<a href="#">
<p id="menu2">About</p>
</a>
<a href="#">
<p id="menu3">Contact</p>
</a>
</div>
<a href="http://www.google.com"><img id="src" src="src.png" /></a>
<img id="ham" src="ham.png" />

<div class="welcome">
<p id="big">Web Design</p>
<p id="sml">
Fusce dapibus, tellus ac cursus commodo, tortor mauris <br />
condimentum , ut fermentum massa justo sit amet <br />
erat a ante venenatis dapibus posuere velit <br />
</p>
</div>
</div>
</div>
<img id="lowerfoto" src="lower.png">
<div class="footer">
<img id="fteweit" src="fterwit.png">
<img id="fterblk" src="fterblk.png">
</div>

而且我的网站右侧有一个空白区域,我无法将其关闭。我发现,菜单正在占用空间,当我删除菜单时,就没有空间了。但是我确实需要那个菜单,那么我需要做什么才能在有菜单的情况下没有空白?

它的样子: http://prntscr.com/ak745y

最佳答案

网站左侧和右侧的额外空间是由默认边距引起的。

为了防止这种情况:

html, body {
margin: 0;
}

更新:您的 ID #menu3 导致了这个问题。我的建议是将元素放在 ul 中,如下所示:

<ul class="menu">
<li id="menu" style="margin-left: 40%;"><a href="#">Home</a></li>
<li id="menu" style="margin-left: 49%;"><a href="#">About</a></li>
<li id="menu" style="margin-left: 58%;"><a href="#">Contact</a></li>
</ul>

.menu li {
display: inline-block;
color: #fff;
text-align: center;
position: absolute;
top: 5.3%;
}

关于html - 网站左侧的空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36233627/

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