关于html 定位 z-index 覆盖问题

    xiaoxiao2026-06-11  15

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> .p1 { border: 2px solid #F00; height: 50px; width: 50px; z-index: 100; display: block; position: relative; } .p2 { border: 2px solid #0FF; height: 50px; width: 100px; margin-top: -10px; display: block; position: relative; } * { margin: 0px; padding: 0px; } </style> </head> <body> <p class="p1"></p> <p class="p2"></p> </body> </html>
    最新回复(0)