HTML与CSS结合的四种方式:

  方式一:每个标签加一个属性:

    例如:<div style="background-color:red; color: green">

       <div>

 

  方式二:head中加style标签 (不好,需要修改HTML文件)

    例如:<style type= text/css>

       div{

         background-color:red;

         color:green;

       }

      </style>

 

  方式三:head中加载CSS文件(只需修改CSS文件)

      注意:这种方法某些浏览器不支持,最好不用

    例如:<style type=text/css>

          @import url (div.css)

       </style>

      CSS文件中

       div{

        background-color:red;

        color:red;

 

      }

 

  方式四:head中使用标签link

    例如:<link rel="stylesheet"  type="text/css"   href="div.css">

  

相关文章:

  • 2022-01-18
  • 2021-12-30
  • 2021-09-16
  • 2021-11-29
  • 2021-12-26
  • 2022-12-23
  • 2021-12-15
  • 2021-06-16
猜你喜欢
  • 2022-12-23
  • 2021-12-10
  • 2021-04-28
  • 2022-01-05
  • 2022-01-11
  • 2021-12-05
  • 2022-12-23
相关资源
相似解决方案