![](/img/trans.png)
[英]Why doesn't my HTML table fill up the entire screen when connected to my 42" screen?
[英]Why my class doesn't fill 100% of the screen?
我的html
文件中有以下脚本:
<template name="SideNav">
<header>Lammah</header>
<body>
dd
</body>
<div class="nav">
<a href="#"><i class="fa fa-user-circle"></i></a>
<a href="#"><i class="fa fa-upload"></i></a>
<a href="#"><i class="fa fa-eye"></i></a>
<a href="#"><i class="fa fa-search"></i></a>
</div>
</template>
下面是.css
文件:
.nav {
border-radius: 5px 5px 0px 0px;
overflow: hidden;
background-color: #b7b7e5;
position: fixed;
bottom: 0;
width: 100%;
}
.nav a {
float: left;
width: 25%;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
a:hover{
background-color: #A3A3CC;
}
当我运行 html 文件时, nav
class 并没有从屏幕的开头开始,左侧有小的空白区域,如下图所示:结果
是什么导致nav
class 无法从屏幕开头(左下角)开始?
当我运行 html 文件时,导航 class 不会从屏幕的开头开始,有
这是因为默认情况下client/main.css
包含以下行:
body {
padding: 10px;
font-family: sans-serif;
}
您应该删除它以删除空白。
此外,在您的模板上添加了一些内容:
head
和body
应该只在您的client/main.html
中,而主体内容将使用模板呈现。 这是因为 Blaze 专注于开发单页应用程序。
所以你的代码client/main.html
可能像下面这样:
<header>
<title>Lammah</title>
</header>
<body>
{{> SideNav }}
</body>
<template name="SideNav">
<div class="nav">
<a href="#"><i class="fa fa-user-circle"></i></a>
<a href="#"><i class="fa fa-upload"></i></a>
<a href="#"><i class="fa fa-eye"></i></a>
<a href="#"><i class="fa fa-search"></i></a>
</div>
</template>
默认边距和填充仍然存在。 您需要确保父元素的边距和填充设置为 0。因此,例如,您要根据上述代码设置的第一个 css 元素是这样的:
template {
margin: 0;
padding: 0;
}
试试这个
margin: 0 !important;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.