html - 单独更改部分div

标签 html css

我正在尝试更改 div 的一部分,这将是我的 Logo ,但它是具有背景的 div 的一部分。我需要 Logo 的背景是透明的,但我看不到变化,因为它是称为“四列”的 div 的一部分。这是代码:

<div class="four columns">
    <h1 id="logo">Unlighted Gaming  <a href="http://unlightedgaming.com"><img id="logo_img" src="http://unlightedgaming.com/wp-content/uploads/2014/04/Menulogo1.png" width="294" height="108" alt="Unlighted Gaming"></a></h1>
</div>
        <!--end logo-->

我试图在 css 中像这样更改它:

.four.columns.logo {
background: #transparent;

但没有运气

难道我不应该使用 CSS 吗?

最佳答案

您将 Logo 用作 id,但在您的 CSS 中您将其称为类。像下面这样更改您的 CSS。

.four.columns #logo {opacity: 0;} /* If you want to hide the element */

.four.columns #logo {background:transparent;} /* If you want to give transparent background*/

如果你想去除黑色,你应该像下面这样写你的代码。

.four.column
{
  background:transparent !important; /* I use important because you want to overwrite the original code*/
}

关于html - 单独更改部分div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24320618/

相关文章:

html - 我无法通过 css 对齐理解的行为

css - 简单表格无法正确显示

javascript - 在鼠标移动到表格单元格上时滚动表格包装器 div。(Chrome)

html - CSS 实现类似的固定 float div,它总是位于其他 div 之上——就像 stackoverflow 一样?

javascript - 如何使用 php 提交输入值,具体取决于基于下拉选择显示的输入值

javascript - contenteditable div : capture input event, 忽略粘贴事件

javascript - native html5 视频播放器与任何其他视频播放器之间的区别

css - 动态删除来自行高的文本上下不必要的空间

javascript - 如何手动管理 HTML 中的文本换行

javascript - res.render 中的 Express-Node JS Handlebars 模板 : How to iterate?