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

CSS结构的基础认知

时间:2018-07-28 22:46:52      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:api   ref   gray   ati   访问   上下   变换   baidu   first   

css的属性值与html的属性值用法不相上下,但是css主要分为内联样式表和外联样式表。

内联样式表用法:在html文件中的《head》头文件中添加<style></style>标签,在标签内添加所需的属性值,例如:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
</style>
</head>

外联样式表用法:在同一项目的目录下创建css为拓展名的文件,在文件编写所需属性和个人style,在HTML内编写代码:<link rel="stylesheet" href="文件名" />进行调用。

CSS样式表规则中class标记和超链接的用法:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
p.first{text-indent: 0.5in;}
p.second{text-indent: 1.0in;}
.main01{font-size: 10pt;color: red;}
#01{font-size: 10pt;color: yellow;}
#02{font-size: 12pt;color: blue;}

        //属性:link链接本身;visited被访问过时;hover指向时;
        a:link{font-size: 10pt;color: blue;text-decoration: none;}
        a:visited{font-size: 13pt;color: gray;text-decoration: underline;}
        a:hover{font-size: 16pt;color: red;text-decoration: overline;}
    </style>
</head>
<body>
    <!--创建class-->
    //<标记 class="类名"></标记>
    //直接用class定义段落的缩进大小
    <p class="first">这个段落缩进0.5in</p>
    <p class="second">这个段落缩进1.0in</p>

    //<标记 class="类名"></标记>
    //调用.main01定义段落和单元格的属性
    <p calss=".main01"></p>
    <td calss="main01"></td>

    //<标记 id="id名">
    <font id="01">php是世界上最好的语言</font>
    <font id="02">php是世界上最好的语言</font>

    <!--超链接-->
    <a href="http://www.baidu.com">first</a>
    《style中的属性一一对应body中class和超链接的用法》

这是一些关于css的属性注释:
/文本对齐/
h1{text-align:center}
/文本缩进/
h1{text-indent: 50px;}
/行高/
body{line-height: 120%;}
/字间距/
body{letter-spacing: 0.1cm;}
/文本装饰/
h3{text-decoration: underline;}
/垂直对齐/
<p>平方值:3<font style="vertical-align:super">2</font></p>
/文本变换/
p{txet-transform:capitalize}

CSS结构的基础认知

标签:api   ref   gray   ati   访问   上下   变换   baidu   first   

原文地址:http://blog.51cto.com/13881481/2151580

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