作者:电脑信息网日期:
返回目录:设置问题
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>字体e799bee5baa6e79fa5e98193e4b893e5b19e331加粗</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
p {
text-align: center;
margin: 16px 0;
}
em {
/* 去掉字体样式 */
font-style: normal;
}
p.strong :nth-child(1) {
font-weight: normal;
}
p.strong :nth-child(2) {
font-weight: bold;
}
p.strong :nth-child(3) {
font-weight: bolder;
}
p.strong :nth-child(4) {
font-weight: lighter;
}
p.strong :nth-child(5) {
/* 等同于bold*/
font-weight: 700;
}
p > em:only-child{
font-style: italic;
}
</style>
</head>
<body>
<hr>
<p>用<b>加粗字体:<b>加粗</b></p>
<hr>
<p>用<strong>加粗字体:<strong>加粗</strong></p>
<hr>
<p class="strong">用CSS font-weight 加粗 <em>normal(400)</em>, <em>bold(700)</em>
, <em>bolder</em>, <em>lighter</em></p>
<hr>
<p>用<i>斜体字体:<i>斜体</i></p>
<hr>
<p>用font-style: italic; 斜体字体:<em>斜体</em></p>
<hr>
<p>用<i>斜体字体:<em>斜体</em></p>
</body>
</html>
可以自行试一下!!!
效果图
直接给表单中对应的元素设置相应的css样式就是可以实现设置字体等属相zhidao的样式的。
设置表单输入框字体样式的代码实例如下:
<!DOCTYPE html>
<html>
<head>
内<meta charset="UTF-8">
<title>float</title>
</head>
<form action="" method="post">
<input type="text" id="text" value="" />
<input type="submit" value=""/>
</form>
</body>
<style>
#text{
color: red;
font-style: italic;
/*设置了字体颜色为红色,容字体为斜体*/
}
</style>
</html>
如上图:css设置input的字体是红色斜体。
可以用style="font-style: italic"来设置。