第一种:

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .c1{
            background-color: brown;
        }
    </style>
    <body>
    <div class="c1">class选择器使用</div>

第二种:

<div class="c1" style="background-color: blue">class选择器使用</div>

第三种:添加link的css文件

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="s.css">

优先级是由内而外,由近到远
css样式的3种方式:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-12-31
  • 2021-12-31
猜你喜欢
  • 2021-12-23
  • 2021-12-10
  • 2021-11-28
  • 2021-11-29
  • 2022-01-21
  • 2021-12-29
相关资源
相似解决方案