简体   繁体   English

如何防止CSS正文影响特定的Div?

[英]How can i prevent a CSS body from affecting a specific Div?

I recently started using Filegator as a file manager for my website, and in my quest of integrating it in my website's design i added my website's header to it. 我最近开始将Filegator用作网站的文件管理器,并且为了将其集成到网站的设计中,我在其中添加了网站的标头。

My problem is that a couple parts of my header seem to be affected by some css rules from Filegator, more specifically some kind of margin/height not being respected. 我的问题是我的标头的几个部分似乎受到Filegator的某些CSS规则的影响,更具体地说,某些边距/高度没有得到遵守。 The part of the header in question is a simple div with the following css : 有问题的标头部分是带有以下css的简单div:

#account {
    position: absolute;
    text-align: left;
    left: 0;
    top: 0;
    font-family: "Century Gothic", CenturyGothic, AppleGothic, sans-serif;
    font-size: 15px;
    color: #3F3F3F;
    margin-left: 10px;
    margin-top: 10px;
    padding: 0 10px 0 10px;
}

After some research i noticed that i comes from a css file name foundation.css and that, inside, if i delete this particular line of code my header goes back to normal : 经过一番研究后,我发现我来自一个css文件名foundation.css,并且在内部,如果我删除了这行代码,我的头文件就会恢复正常:

body
{
    background: white;
    color: #222222;
    font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1;
    position: relative;
    webkit-font-smoothing: antialiased;
}

Thing is that line of code is essential for the file manager, so i tried adding the famous :not() like this : 问题是代码行对于文件管理器至关重要,因此我尝试添加著名的:not(),如下所示:

  body:not(#account)
{
    background: white;
    color: #222222;
    font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1;
    position: relative;
    webkit-font-smoothing: antialiased;
}

But body:not() did not change anything. 但是body:not()并没有改变任何东西。

It gets even worse if i write it with a space between body and :not() 如果我用body和:not()之间的空格写它,那就更糟了。

Does anyone have suggestions to help me with this ? 有人有建议可以帮助我吗? Any help would be really appreciated 任何帮助将非常感激

Thanks 谢谢

-Apatik -阿帕蒂克

the only rule that you don't override seems line-height, so you could try to explictly set or unset this in you 'account. 唯一不能忽略的规则是行高,因此您可以尝试在帐户中明确设置或取消设置。

#account{
  ...
 line-height:0; 
}

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

相关问题 如何防止第一个孩子的CSS也影响HTML表中的第二个孩子? - How can I prevent first-child CSS from also affecting the second child in my HTML Table? 如何防止 div 内的文本影响 div 周围的间距 - How to prevent text inside a div from affecting the spacing around div 如何防止响应式div使用CSS进入另一个div? - How can I prevent a responsive div from going into another div using CSS? 如何防止CSS过渡影响页面上的其他图标? - How do I prevent a CSS transition from affecting my other icons on my page? 如何防止浏览器的宽度影响文本的垂直位置? - How can I prevent the browser's width from affecting the vertical position of text? 如何防止 ::before 伪元素影响我的 flex 布局? - How can I prevent the ::before pseudo element from affecting my flex layout? 如何防止HTML源格式影响输出? - How do I prevent HTML source formatting from affecting output? “页脚”div下了“主”div div我怎样才能设置css鳕鱼? - “footer” div went under the “main” body div how can I set css cods? 如何在特定角度将CSS转换应用于div元素? - How can I apply a CSS transformation to a div element in a specific angle? 如何在不影响周围文本的情况下将文本添加到div? - How can I add text to a div without affecting the surrounding text?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM