要点:

代码:

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title><style> div{ position: relative; } p{ width: 50px; height: 50px; background: red; opacity: 0.5; position: absolute; z-index: 999; top: 0; left: 0; }</style></head><body><h4>外部元素</h4><h4>外部元素</h4><h4>外部元素</h4><div> <h4>内部元素</h4> <h4>内部元素</h4> <h4>内部元素</h4> <p></p></div></body></html>效果: