簡體   English   中英

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

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

我最近開始將Filegator用作網站的文件管理器,並且為了將其集成到網站的設計中,我在其中添加了網站的標頭。

我的問題是我的標頭的幾個部分似乎受到Filegator的某些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;
}

經過一番研究后,我發現我來自一個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;
}

問題是代碼行對於文件管理器至關重要,因此我嘗試添加著名的: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;
}

但是body:not()並沒有改變任何東西。

如果我用body和:not()之間的空格寫它,那就更糟了。

有人有建議可以幫助我嗎? 任何幫助將非常感激

謝謝

-阿帕蒂克

唯一不能忽略的規則是行高,因此您可以嘗試在帳戶中明確設置或取消設置。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM