html - 辅助 Css 文档对具有 id 的相关 div 没有影响

标签 html css

<分区>

在我的网站上,无论出于何种原因,CSS 拒绝对 html 生效,据我所知,仅从该特定工作表可以看出,我的全局工作表似乎运行良好。

HTML:

<!DOCTYPE html>
    <html>
    <head>
    <title>Anise Technologies</title>
    <meta charset="utf-8">
    <?php include 'global/includes/header.php'?>
    <link rel="stylesheet" type="text/css" href="home.css">
    </head>
    <body>
    <?php include 'global/includes/nav.php'?>
        <div id="main">
            <div id="slider">
            </div>
            <div id="promo-tiles">
                <ul>
                    <li></li>
                    <li></li>
                    <li></li>
                    <li></li>
                </ul>
            </div>
        </div>
    <?php include 'global/includes/footer.php'?>
    </body>
    </html>

CSS:

@charset "utf-8";
/* CSS Document FOR HOME PAGE ONLY*/
.main {
    height: 100%;
}
.slider {
    height: 60%;
}
.promo-tiles {
    height: 30%;
}
.promo-tiles-ul{
    width: 25%;
    display: inline-block;
    list-style: none;
}
.promo-tiles li{
    color: white;
}

最佳答案

您正在使用类选择器。将它们更改为 id 选择器

#main {
    height: 100%;
}
#slider {
    height: 60%;
}
#promo-tiles {
    height: 30%;
}
#promo-tiles ul{
    width: 25%;
    display: inline-block;
    list-style-type: none;
}
#promo-tiles li{
    color: white;
}

关于html - 辅助 Css 文档对具有 id 的相关 div 没有影响,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34846218/

相关文章:

javascript - 是否有图像映射的替代方案能够更改图像上特定 div 区域的背景颜色?

html - Web 浏览器跳转到网站上的特定 H1/div

CSS 动画 chrome 滞后

javascript - 如何确定 DOM 对象上的 CSS 选择器?

JavaScript 改变 HTML 内容

javascript - Div 到达顶部时粘在顶部并且仅在向上滚动时显示

html - 复制div背景

css - 如何在 Tumblr 上的非永久链接页面上隐藏 <div>

html - 如何在顶部的导航栏中放置固定 Logo ?

css - 基于top()和bottom()在CSS中设置DIV的高度