html - CSS不包括html类中的样式
问题描述
.title 没问题。.flavor 不承认这些更改。HTML class="flavor" 在呈现网页时不显示样式。
<div class="title">
<h1> HEAVENS ICE CREAM </H1>
<div> 1 </div>
<div> 2 </div>
</div>
<div class="flavor">
<div>
<p> Peach </p>
</div>
<div>
<p> Coconut </p>
</div>
</div>
.title
{
display: flex;
flex-direction: row-reverse;
color: red;
background-color: grey;
};
.flavor
{
display: flex;
background-color: grey;
color: blue;
};
解决方案
一些事情 - 在调用 CSS 之后,最后不需要分号 - 将 CSS 放入样式标签中。如果没有样式标签,HTML 不能在没有说明这段代码是什么的情况下引用 CSS(就像这样)
<style type="text/css">
.title
{
display: flex;
flex-direction:
row-reverse;
color: red;
background-color: grey;
}
.flavor
{
display: flex;
background-color: grey;
color: blue;
}
</style>
推荐阅读
- java - Java 7中两个日期之间的年差
- php - 我的联系表格中的邮件布局有问题
- symfony - 如何在前端使用 datagrid 的导出功能
- c# - 如何创建一个给出指定列名和类型的 sql 表
- python - C++ 特征库中的 argmax() 方法
- javascript - 我无法声明的内容安全政策错误
- scala - 如果异步添加处理程序,则通过 netty 通道丢失的消息
- javascript - 使用 MSAL2 登录后验证服务器上的用户
- shell - MSB4019 使用 Github 操作运行 Xamarin Android 单元测试
- java - 在运行 Spring 项目时为 VSCode 终端中的“Java 进程控制台”提供颜色主题