我该如何获得这种效果:
我需要将data标签用作标题:
这是结果。问题在于当您滚动时,
谢谢
<pre class="default prettyprint prettyprinted" data-codetitle="homepage.html" style=""><code>
body{
position: relative;
@include background(linear-gradient(left, lighten($me, 11%), lighten($me, 11%)
$half, $darkbackground $half, $darkbackground));
color: $text;
width: 100%;
height: 100%;
@include breakpoint(baby-bear) {
@include background(linear-gradient(left, lighten($me, 11%), lighten($me, 11%)
45%, $darkbackground 45%, $darkbackground));
}
}
</span></code></pre>
我需要将data标签用作标题:
.prettyprint {
margin: 0 0 0 0.5%;
border-left: 2px solid #ce8f80;
overflow: auto;
position: relative;
width: 300px;
}
.prettyprint:before {
content: attr(data-codetitle);
background: #ce8f80;
display: block;
width: 100%;
}
这是结果。问题在于当您滚动时,
:before
元素也会滚动。有没有办法使此元素保持固定。我尝试了不同的变化,但无法使其正常工作。谢谢