绝对定位和相对定位

原创 2019-01-31 20:26:32 283
摘要:<!DOCTYLE html><html><head><meta charset="utf-8"><title>绝对定位和相对定位,导航</title><style>.b{background:pink;width:600px;height:400px;position:relative; to


<!DOCTYLE html>


<html>


<head>


<meta charset="utf-8">


<title>绝对定位和相对定位,导航</title>


<style>

.b{background:pink;width:600px;height:400px;position:relative; top:10px;left:20px;text-align:center;color:white;font-size:20px;line-height:50px;}

.b p{background:green;text-align:left;}

.a{background:green;width:300px;height:200px;color:white;font-size:12px;text-align:left;position:absolute; bottom:0px;right:0px;line-height:40px;}

.a p{background:pink;}



</style>


</head>


<body>


<div  class="b"><p>我是相对定位,relative,top,left值,absolute,你有吗?估计你也有,谁让你是我儿子呢?</p>




  <div  class="a">

     <p>我是绝对定位,我要找个爸爸,他还要有relative,否则我就离开他再找爸爸</p>


  </div>

</div>


</body>






</html>


批改老师:韦小宝批改时间:2019-02-01 09:52:03
老师总结:写的很不错 有点意思 css中唯一比较复杂的也就是定位了 一定要多练习哦!

发布手记

热门词条