Css_文本$字体

首先来看看字体的颜色:
color属性:

<!DOCTYPE  html>
<html>
<head>
<meta charset="UTF-8"/>
<style>
#cc{
color:green;
background-color:yellow;
width:50%;
heigth:100px;
padding:20px 20px;
}
</style>
</head>
<body>
<h1  id="cc">给字体设置颜色</h1>
</body>
</html>

text-align:设置文本的对齐方式,主要讲justify这个属性,该属性的作用是使当前的文本宽度前后保持一致,就像报纸的排版一样

<!DOCTYPE  html>
<html>
<head>
<meta charset="UTF-8"/>
<style>
#cc{
color:green;
background-color:yellow;
width:50%;
heigth:100px;
padding:20px 20px;
text-align:justify;
}
#c1{
color:yellow;
background-color:green;
width:50%;
height:200px;
text-align:left;
}
</style>
</head>
<body>
<h1  id="cc">给字体设置justify属性使其保持前后宽度一致</h1>
<h1  id="c1">设置字体向左对齐</h1>
</body>
</html>

text-decoration:用来设置或删除文本的一种修饰,说白了就是一个下划线来修饰文本

<!DOCTYPE  html>
<html>
<head>
<meta charset="UTF-8"/>
<style>
#cc{
color:green;
background-color:yellow;
width:50%;
heigth:100px;
padding:20px 20px;
text-align:justify;
text-decoration:overline;
}
#c1{
text-decoration:line-through;
}
#c2{
text-decoration:underline;
}
</style>
</head>
<body>
<h1  id="cc">使用overline来修饰,overline越过线,意思就是越过字体,在字体上方修饰</h1>
<h1  id="c1">使用line-through来修饰,穿过字体修饰</h1>
<h1  id="c2">使用underline来修饰,在字体下方进行修饰</h1>
</body>
</html>

transform:文本转换,大小写之间的转换

<!DOCTYPE  html>
<html>
<head>
<meta charset="UTF-8"/>
<style>
#cc{
text-transform:uppercase;
text-decoration:underline;
}
#c1{
text-transform:lowercase;
text-decoration:underline;
}
#c2{
text-transform:capitalize;
text-decoration:underline;
}
</style>
</head>
<body>
<h1  id="cc">uppercase</h1>
<h1  id="c1">lowercase</h1>
<h1  id="c2">capitalize</h1>
</body>
</html>

indent:文本缩进单位px

<!DOCTYPE  html>
<html>
<head>
<meta charset="UTF-8"/>
<style>
#cc{
text-transform:uppercase;
text-decoration:underline;
text-indent:50px;
}
#c1{
text-transform:lowercase;
text-decoration:underline;
text-indent:40px;
}
#c2{
text-transform:capitalize;
text-decoration:underline;
text-indent:30px;
}
</style>
</head>
<body>
<h1  id="cc">uppercase</h1>
<h1  id="c1">lowercase</h1>
<h1  id="c2">capitalize</h1>
</body>
</html>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值