html - 图片未触摸屏幕边框
问题描述
我正在编写一个网站,背景图片不适合整个屏幕,图片和屏幕边框之间有空白。我在谷歌上搜索了一个小时,“边距:0;填充:0 ; 边界:0;" 一切都没有奏效。
这是我的代码:
nav ul {
border-style: solid;
border-width: 0px;
padding: 10px;
margin: 0px 0px 0px 0px;
background-color: none;
text-align: center;
}
nav ul li {
list-style-type: none;
display: inline;
margin-right: 10px;
margin-left: 10px;
color: black;
font-size: 150%;
}
nav ul li a {
text-decoration: none;
color: black;
}
#big {
text-align: right;
color: black;
margin: 10px 0px 0px 0px;
padding: 10px 0px 0px 0px;
}
#first {
background-image: url('https://www.google.fr/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png');
background-repeat: no-repeat;
background-size: cover;
margin: 0px 0px 0px 0px;
display: block;
max-width: 100%;
height: auto;
margin: 0;
padding: 0;
border: 0;
}
#text1 {
text-align: center;
}
#nav1 {
position: fixed;
text-align: center;
height: auto;
width: auto;
}
jpg {
line-height: 0px height:100%;
}
h1 {
margin-top: 5in;
}
<div id="first" background-image="Logo.jpg">
<header>
<nav id="nav1">
<ul>
<li>Home</li>
<li><a href="join_us.html">Join</a></li>
<li><a href="contact_us.html">Contact us</a></li>
<li><a href="about_us.html">About us</a></li>
<li><a href="Sub.html">Subscriptions</a></li>
</ul>
</nav>
</header>
<br><br>
<h1 id="big">############################.</h1>
<p>.</p>
<br><br><br><br><br>
</div>
抱歉,我的代码安排不当且不专业。我真的很感激一个答案。
解决方案
我相信你应该添加你的CSS
html,
body {
padding: 0;
margin: 0;
}
默认情况下,文档正文周围有一个边距,这就是您在图片周围看到白色边框的原因
html,
body {
margin: 0;
padding: 0;
}
nav ul {
border-style: solid;
border-width: 0px;
padding: 10px;
margin: 0px 0px 0px 0px;
background-color: none;
text-align: center;
}
nav ul li {
list-style-type: none;
display: inline;
margin-right: 10px;
margin-left: 10px;
color: black;
font-size: 150%;
}
nav ul li a {
text-decoration: none;
color: black;
}
#big {
text-align: right;
color: black;
margin: 10px 0px 0px 0px;
padding: 10px 0px 0px 0px;
}
#first {
background-image: url('https://www.google.fr/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png');
background-repeat: no-repeat;
background-size: cover;
margin: 0px 0px 0px 0px;
display: block;
max-width: 100%;
height: auto;
margin: 0;
padding: 0;
border: 0;
}
#text1 {
text-align: center;
}
#nav1 {
position: fixed;
text-align: center;
height: auto;
width: auto;
}
jpg {
line-height: 0px height:100%;
}
h1 {
margin-top: 5in;
}
<div id="first">
<header>
<nav id="nav1">
<ul>
<li>Home</li>
<li><a href="join_us.html">Join</a></li>
<li><a href="contact_us.html">Contact us</a></li>
<li><a href="about_us.html">About us</a></li>
<li><a href="Sub.html">Subscriptions</a></li>
</ul>
</nav>
</header>
<br><br>
<h1 id="big">############################.</h1>
<p>.</p>
<br><br><br><br><br>
</div>
推荐阅读
- sql - SQL 检查约束使用 LIKE 和 OR
- python - 使用正则表达式和 Pandas 分隔字符串
- r - 仅当一列包含特定值时,删除至少包含 NA 的行
- c# - VS2019 (16.8.1)、C#、XML 注释、智能感知未显示
- flutter - Flutter、DropDownButton 检测到 0 个或 2 个或多个 [DropdownMenuItem] 具有相同的值
- sql - 计算不同单词在列中出现的次数 Oracle 12c SQL
- android - Android Camera2 输出分辨率与请求的分辨率不匹配
- c# - 如何在 EF 中包含对象的所有级别?
- xamarin.android - 如果将 Xamarin.Android 项目的 IDE 从 VS 2017 社区版更改为 VS 2019 社区版,是否会出现潜在问题?
- node.js - 在更新模式 mongoose 之前访问 Mongodb 数据