![]() |
1
1
我不认为有任何方法可以使用纯CSS来实现这一点。不管你如何分割它,你都在尝试以悬停元素的父元素为目标,即使你发现了一个黑客,它也可能依赖于浏览器。 这里最好的建议是为优雅的降级定义一个基本的滚动,然后使用JS添加一个类来实现您想要的实际效果。 |
![]() |
2
0
http://www.webdevout.net/test?0q&raw 艾斯 <!doctype html> <html> <head> <title></title> <style> #box { position: relative; } #back { width: 200px; height: 200px; padding: 100px; background: fuchsia; } a { display: block; width: 200px; height: 200px; background: aqua; position: relative; } span { display: none; position: absolute; background: lime; } a:hover span { display: block; } span.n { width: 400px; height: 100px; left: -100px; top: -100px; } span.e { width: 100px; height: 200px; right: -100px; top: 0; } span.s { width: 400px; height: 100px; left: -100px; bottom: -100px; } span.w { width: 100px; height: 200px; left: -100px; top: 0; } div.n, div.e, div.s, div.w { position: absolute; z-index: 1; } div.n { width: 400px; height: 100px; left: 0; top: 0; } div.e { width: 100px; height: 200px; left: 300px; top: 100px; } div.s { width: 400px; height: 100px; left: 0; top: 300px; } div.w { width: 100px; height: 200px; left: 0; top: 100px; } </style> </head> <body> <div id="box"> <div id="back"> <a href="#"> <span class="n"></span> <span class="e"></span> <span class="s"></span> <span class="w"></span> </a> </div> <div class="n"></div> <div class="e"></div> <div class="s"></div> <div class="w"></div> </div> </body> </html> 不 IE6 support 可能不值得使用。 |
|
Jamie · 在CSS链接的文件名中添加Jinja占位符 5 月前 |
![]() |
Mass · 如何在Tailwind CSS v4中创建配置 5 月前 |
![]() |
magenta placenta · 将css变量合并为一个变量 5 月前 |
![]() |
ptownbro · 重叠分区标签,同时保持以下所有分区和内容就位 5 月前 |
![]() |
john Rizzo · 按钮背景颜色、悬停和活动状态存在问题 6 月前 |