zl程序教程

您现在的位置是:首页 >  其他

当前栏目

【项目实战】CSS入门介绍

项目CSS入门 介绍 实战
2023-09-14 09:14:14 时间

一、 CSS属性学习清单

1.1 background背景设置

background-color
为元素设置背景颜色。

background-image:url(/i/XXX.gif)
将图像设置为背景。

background: #ff0000 url(/i/XXX.gif ) no-repeat fixed center;
使用简写属性来将所有背景属性设置在一个声明之中。

1.2 文本颜色、文本大小、对齐、添加修饰

color:red
color:#00ff00
color:rgb(0,0,255)
设置文本的颜色。

background-color:yellow
设置文本的颜色。

line-height: 90%
line-height: 200%
使用百分比值来设置段落中的行间距。
在大多数浏览器中默认行高大约是 110% 到 120%。

line-height: 10px line-height: 30px
使用像素值来设置段落中的行间距。
在大多数浏览器中默认行高大约是 20px。

line-height: 0.5
line-height: 2
使用一个数值来设置段落中的行间距。
默认行高大约是 1。

text-align: center
text-align: left
text-align: right
对齐文本

text-decoration: overline
text-decoration: line-through
text-decoration: underline
text-decoration:blink
a {text-decoration: none}
向文本添加修饰

1.3 字体、字体尺寸、字体风格

font-family:"Times New Roman",Georgia,Seriffont-family:Arial,Verdana,Sans-serif
设置文本字体。

font-size:
300%设置字体尺寸。

font-style:normal
font-style:italic
font-style:oblique
设置字体风格。

font-weight: normal
font-weight: bold
'font-weight:

900设置字体的粗细。

font:italic arial,sans-serif;font:italic bold 12px/30px arial,sans-serif;
使用简写属性将字体属性设置在一个声明之内。