繁体   English   中英

整个网站的CSS边距更改,是否有其他方法可以覆盖?

[英]CSS changing margin of the entire website, is there anyway to override this?

当我为表单添加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%;
  }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM