Java教程

缩进

本文主要是介绍缩进,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>阴影-陈敏芳</title>
<style type="text/css">
body{
font-size: 20px;
}
h1{
font-family: 微软雅黑;
color: #fff;
background: #fc0;
text-align: center;
height: 100px;
line-height: 100px;
text-shadow: 6px 6px 3px #333333;
}
.box{
border: 1px dotted #06F;
padding: 5px;
margin: 10px;
}
#box-1{
text-indent: 24px;
}
#box-2{
text-indent: 2em;
}
</style>
</head>
<body>
<h1>注意此处的行高和阴影</h1>
<div class="box">
<h3>此容器使用具体像素进行缩进</h3>
<p id="box-1">此处缩进设置为24像素,由于不是相对单位,一旦全局字号发生改变时,就不能准确缩进两个汉字的距离</p>
</div>
<div class="box">
<h3>此容器使用相对值进行缩进</h3>
<p id="box-2">
此处使用相对值进行缩进,无论全局字号如何改变,均能保证精确缩进两个汉字的距离。</p>
</div>
</body>
</html>

输出效果:

 

这篇关于缩进的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!