2-14 编程练习作业提交
来源:2-14 编程练习
MiMicccc
2020-08-31 11:48:08
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> * { margin: 0; padding: 0; } .test { width: 800px; height: 100px; background: red; /*此处写代码*/ position: fixed; top: 0; left: 50%; margin-left: -400px; /* left:50%搭配margin-left:-自身宽度的一半 right:50%搭配margin-ringht:-自身宽度的一半 */ } .out { width: 100%; height: 2000px; background-color: #abcdef; } </style> </head> <body> <div class="out"> <div class="test"></div> </div> </body> </html>
1回答
好帮手慕言
2020-08-31
同学你好,效果实现的不错,看来同学对这块知识点掌握的不错,继续加油,祝学习愉快~
相似问题