html中position的使用介绍

用户使用屏幕越来越大,页面越来越宽,不适宜大家阅读,所以大多数网站的主体宽度与以前相比没有太大的变化,所以浏览器中有越来越多的空白区域,那么html中position的使用介绍,一起跟着爱站技术频道小编来学习吧!

复制代码

代码如下:


<html>

<head>

<title>day03.html</title>

<style type=”text/css”>

/*首先写一个position的div*/

#car{

width:150px;height:30px;

background: #999999;

color:white;text-align: center;

line-height: 30px;margin: 232px 300px;

border:1px solid black;position: relative;

}

#num{

width:20px;height:20px;background: red;

color:white;text-aligh:center;

line-height:20px;position: absolute;

top:-15px;left:25px;

}

</style>

</head>

<body>

<div id=”car”>

去购物车付款

<div id=”num”>0</div>

</div>

</body>

</html>

以上就是关于html中position的使用介绍,我们可以按照上述的介绍进行操作,有不足的地方可以在下方给爱站技术频道小编进行留言,我们会在第一时间为您解答。