CSS基础-介绍及语法

来源:互联网 发布:搜达数据 编辑:程序博客网 时间:2024/06/07 22:27
</pre><pre style="background-color: rgb(255, 255, 255); font-family: Menlo; font-size: 12pt;"><strong>CSS基础语法</strong>

CSS链接到样式

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

CSS高级语法

1: 选择器分组:

h1,h2,h3,h4,h5,h6{color : red;}

2: 继承:

body{

color: green;

}

body定义的是body里面所有字体的颜色样式(没有属于它自己单独的样式)。

派生选择器

1:派生选择器:通过依据元素在其位置的上下关系来定义样式。
.html
<p><strong>p标签 hello Css</strong></p><ul>    <li>        <strong>li标签</strong>    </li></ul>
.Css
<pre style="background-color: rgb(255, 255, 255); font-family: Menlo; font-size: 12pt;"><pre name="code" class="css">li strong{    color: red;}strong{    color: green;}

显示效果:

通过li 下面的 strong指定文字的颜色。



0 0
原创粉丝点击