码迷,mamicode.com
首页 > Web开发 > 详细

CSS的引入方式

时间:2019-10-14 01:03:19      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:color   href   index   world   格式   span   就是   mys   link   

CSS的引入方式

一、行内样式

行内式是在标记的style属性中设定CSS样式。不推荐大规模使用。

<p style="color: red">Hello world.</p>

二、内联样式

嵌入式是将CSS样式集中写在网页的标签对的标签对中。格式如下:


<head>
  <meta charset="UTF-8">
  <title>Title</title>
   <style type="text/css">
    /*写我们的css代码*/
        
    span{
    color: yellow;
    }

</style>
</head>

三、外联样式——链接式

外部样式就是将css写在一个单独的文件中,然后在页面进行引入即可。推荐使用此方式。

<link href="mystyle.css" rel="stylesheet" type="text/css"/>

四、外接样式——导入式

<style type="text/css">
        @import url('./index.css');
</style> 

CSS的引入方式

标签:color   href   index   world   格式   span   就是   mys   link   

原文地址:https://www.cnblogs.com/randysun/p/11669058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!