摘要:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> .box1{ width: 200px; height: 100p
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> .box1{ width: 200px; height: 100px; border: 1px solid #ccc; position: relative; float: left; } .box2{ width: 100px; height: 50px; border: 1px solid red; position: absolute; left: 0; bottom: 0; } /*子绝父相*/ .box3{ clear: both;/*清除浮动*/ } .box4{ width: 300px; height: 200px; border: 1px solid red; } </style> </head> <body> <div class="box1">父元素 <div class="box2">子元素</div> </div> <div class="box3"></div> <div class="box4"></div> </body> </html>
批改老师:韦小宝批改时间:2019-01-22 09:25:49
老师总结:写的很不错 css中的浮动很重要 当然浮动也会带来很大的麻烦 要记得清除浮动