html - CSS改变整个网站的边距,有没有办法覆盖它?
问题描述
当我为表单添加 css 文档时,它会破坏我的页边距。我已经尝试将所有边距和填充更改为 0,但没有帮助。唯一可行的方法是删除整个 css 文件。我也尝试删除 css 中的所有正文引用,但问题仍然存在。我还尝试将 !important 添加到页面的主 css 中。我不确定是什么导致了 css 文件中的这个问题。当我在浏览器中检查代码时,它并没有显示这个 css 正在被使用。
body {
margin: 0px;
aside {
background: #1f8dd6; /* same color as selected state on site menu */
padding: 0.3em 1em;
border-radius: 3px;
color: #fff;
margin-bottom: 2em;
}
textarea {
width: 100%;
}
.content-head {
font-weight: 400;
text-transform: uppercase;
letter-spacing: 0.1em;
margin: 2em 0 1em;
}
.is-center {
text-align: center;
}
.button-success {
color: white;
border-radius: 4px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(28, 184, 65); /* this is a green */
}
.button-xlarge {
font-size: 125%;
}
button {
float: right;
}
#name, #email {
width: 50%;
}
}
解决方案
您的 css 文件包含每个类、元素、id 两次。因此它给出了问题。
从您的 css 文件中删除所有代码并粘贴,
body {
margin: 0px;
aside {
background: #1f8dd6;
/* same color as selected state on site menu */
padding: 0.3em 1em;
border-radius: 3px;
color: #fff;
margin-bottom: 2em;
}
textarea {
width: 100%;
}
.content-head {
font-weight: 400;
text-transform: uppercase;
letter-spacing: 0.1em;
margin: 2em 0 1em;
}
.is-center {
text-align: center;
}
.button-success {
color: white;
border-radius: 4px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(28, 184, 65);
/* this is a green */
}
.button-xlarge {
font-size: 125%;
}
button {
float: right;
}
#name,
#email {
width: 50%;
}
推荐阅读
- reactjs - React NavBar 无法摆脱一个点
- python - Python OpenCV calibrateCamera:objectPoints 应包含 Point3f 类型点的向量向量
- python-3.x - nested dictionary in list to dataframe python
- apache - Apache 无法与 8009 端口以外的后端通信
- ssh - tigervnc 未与本地主机连接
- python-3.x - md5(str.encode(var1)).hexdigest() 将十六进制值设为 382fbe213f159eecf85facb256f265d0 - 如何知道 var1?
- sql - SQL Server:多个小表与一个大表进行搜索
- r - R:如何绘制由 lm poly fit 生成的自定义多项式范围
- vue.js - 为什么路由器查询不会在 nuxt 中立即更新?
- c# - 在标签 href中调用 Url.Action 时,Modal 中缺少内容