首页 > 解决方案 > Css 没有反映在 html 中

问题描述

我的 .css 文件中有这个

.attachment-label {
    font-size: 10px;
    font-style: italic;
    color: rgba(0,0,0,.5);
}

我尝试在我的 html 中使用它,如下所示:

<div class="card-body">
                    <span class="attachment-label">Attachment</span>
                    <hr style=" margin-top: 0; margin-bottom: .5rem; border: 0; border-top: 1px solid rgba(0,0,0,.1);"/>
                    <div class="text-center">
                        <img class="card-img-top imageThumbnail" src="@TicketHeader.AttachmentPath" />
                    </div>
                </div>

它不适合我的跨度。但是,如果我像这样将样式内联:

<div class="card-body">
                    <span style=" font-size: 10px; font-style: italic; color: rgba(0,0,0,.5);">Attachment</span>
                    <hr style=" margin-top: 0; margin-bottom: .5rem; border: 0; border-top: 1px solid rgba(0,0,0,.1);"/>
                    <div class="text-center">
                        <img class="card-img-top imageThumbnail" src="@TicketHeader.AttachmentPath" />
                    </div>
                </div>

有用。我究竟做错了什么?

标签: htmlcss

解决方案


我认为你没有链接你的 .css 文件

<link rel="stylesheet" href="css/your.css">

推荐阅读