温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

CSS结构的基础认知

发布时间:2020-06-17 14:16:30 来源:网络 阅读:501 作者:A追途 栏目:web开发

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的属性注释:
/文本对齐/
h2{text-align:center}
/文本缩进/
h2{text-indent: 50px;}
/行高/
body{line-height: 120%;}
/字间距/
body{letter-spacing: 0.1cm;}
/文本装饰/
h4{text-decoration: underline;}
/垂直对齐/
<p>平方值:3<font style="vertical-align:super">2</font></p>
/文本变换/
p{txet-transform:capitalize}

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI