常用字体属性
font-family :指定字体类型
font- size:指定文本的字体大小
font-style:指定文本的字体样式
font-weight:指定文本的字体粗细
font:在一个声明中设置所有的字体属性
注意:font: font-style | font-weight | font-size | font-family;
1.必须按照上面书写的顺序书写,不能更换顺序,并且各个属性之间用空格隔开。
2.必须保留font-size和font-family属性,否则font不生效
字体图标
字体图标展示的是图标,本质属于字体。主要用于显示网页中通用、常用的一些小图标。
字体图标的优势:
一个图标字体要比一系列的图像要小。一旦字体加载了,图标就会马上渲染出来,减少了服务器请求。
字体图标本质是文字,可以随意的改变颜色、产生阴影、透明效果、旋转等
常用文本属性
color:设置文本颜色
text-align:对齐元素中的文本
text-decoration:向文本添加修饰
line-height:设置行高
文本的外观,比如文本颜色,对齐文本等等;行间距=上间距+文本高度+下间距
其他常用样式
width:元素的宽度
height:元素的高度
background:背景颜色
opacity:元素透明度
overflow:指定内容溢出一个元素的框
案例应用:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>baidu</title>
<style>
.images{
text-align:center ;
}
.group{
text-align:center ;
}
.under{
font-size: 10px;
width: 100%;
height: 60px;
position: fixed;
bottom: 0;
}
.pro{
font-size: 10px;
opacity: 0.5;
position: absolute;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<div class="images">
<img src="../css/image/bdlogo.gif">
</div>
<div class="group">
<a href="http://news.baidu.com/">新闻</a>
<a href="">网页</a>
<a href="https://tieba.baidu.com/index.html">贴吧</a>
<a href="https://tieba.baidu.com/index.html">知到</a>
<a href="https://tieba.baidu.com/index.html">音乐</a>
<a href="https://tieba.baidu.com/index.html">图片</a>
<a href="https://tieba.baidu.com/index.html">视频</a>
<a href="https://tieba.baidu.com/index.html">地图</a><br>
<br>
<input type="text" name="text1" size="50" maxlength="60" width="50">
<input type="submit" name="提交" value="百度一下"><br>
<br>
<a href="https://tieba.baidu.com/index.html">百科</a>
<a href="https://tieba.baidu.com/index.html">文库</a>
<a href="https://tieba.baidu.com/index.html">贴吧</a>
<a href="https://tieba.baidu.com/index.html">hao123</a>
<span>|</span>
<a href="https://tieba.baidu.com/index.html">更多>></a>
<br>
<br>
<br>
<div class="under">
<a href="https://tieba.baidu.com/index.html">把百度设为主页安装百度浏览器</a><br>
<a href="https://tieba.baidu.com/index.html">加入百度推广|</a>
<a href="https://tieba.baidu.com/index.html">搜索风云榜|</a>
<a href="https://tieba.baidu.com/index.html">关于百度|</a>
<a href="https://tieba.baidu.com/index.html">About Baidu</a>
</div>
<div class="pro">
<p>2013 Bai du 使用百度前必读 京ICP证030173号</p>
</div>
</div>
</body>
</html>
案例效果: