aby*_*gic 18 css nested css-position parent-child
我试图在内联/内联块锚链接上定位一个渐变,并让该渐变继承该父锚的宽度.问题是跨度要么继承锚的父级的整个宽度,要么只是继承的宽度.我无法让span元素正确继承宽度,同时保持锚点内联显示.
CSS
a { width: auto; display: inline-block; }
a span { background: url(../images/fade_h1.png); width: 100%; height: 12px; position: absolute; display: block; z-index: 3; }
Run Code Online (Sandbox Code Playgroud)
HTML
<a href="index.php"><span> </span>Index</a>
Run Code Online (Sandbox Code Playgroud)
Pek*_*ica 24
position: absolute据我所见,无法完成.
我不确定这是否会为你服务,但是如何给予你a position: relative和a span
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
Run Code Online (Sandbox Code Playgroud)
?