内容简介:css基本语法及页面引用css基本语法css的定义方法是:
css基本语法及页面引用
css基本语法
css的定义方法是:
选择器 { 属性:值; 属性:值; 属性:值;}
选择器是将样式和页面元素关联起来的名称,属性是希望设置的样式属性每个属性有一个或多个值。代码示例:
div{ width:100px; height:100px; color:red }
css页面引入方法:
1、外联式:通过link标签,链接到外部样式表到页面中。
<link rel="stylesheet" type="text/css" href="css/main.css">
2、嵌入式:通过style标签,在网页上创建嵌入的样式表。
<style type="text/css">
div{ width:100px; height:100px; color:red }
......
</style>
3、内联式:通过标签的style属性,在标签上直接写样式。
<div style="width:100px; height:100px; color:red ">......</div>
css文本设置
常用的应用文本的css样式:
- color 设置文字的颜色,如: color:red ;
- font-size 设置文字的大小,如: font-size:12px ;
- font-family 设置文字的字体,如: font-family:'微软雅黑' ;
- font-style 设置字体是否倾斜,如: font-style:'normal' ;设置不倾斜, font-style:'italic' ;设置文字倾斜
- font-weight 设置文字是否加粗,如: font-weight:bold ; 设置加粗 font-weight:normal 设置不加粗
- font 同时设置文字的几个属性,写的顺序有兼容问题,建议按照如下顺序写: font:是否加粗 字号/行高 字体;如: font:normal 12px/36px '微软雅黑' ;
- line-height 设置文字的行高,如: line-height:24px ;
- text-decoration 设置文字的下划线,如: text-decoration:none ; 将文字下划线去掉
- text-indent 设置文字首行缩进,如: text-indent:24px ; 设置文字首行缩进24px
- text-align 设置文字水平对齐方式,如 text-align:center 设置文字水平居中
-
学院 Go 语言视频主页
https://edu.csdn.net/lecturer/1928 -
扫码获取海量视频及源码 QQ群:721929980
以上所述就是小编给大家介绍的《1.5 常用CSS样式1:文本样式》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
PHP for the World Wide Web, Second Edition (Visual QuickStart Gu
Larry Ullman / Peachpit Press / 2004-02-02 / USD 29.99
So you know HTML, even JavaScript, but the idea of learning an actual programming language like PHP terrifies you? Well, stop quaking and get going with this easy task-based guide! Aimed at beginning ......一起来看看 《PHP for the World Wide Web, Second Edition (Visual QuickStart Gu》 这本书的介绍吧!
RGB CMYK 转换工具
RGB CMYK 互转工具
HSV CMYK 转换工具
HSV CMYK互换工具