首页 > 解决方案 > 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;
};

标签: htmlcss

解决方案


一些事情 - 在调用 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>

推荐阅读