I'm showing code in an ordered list, so that it displays with line numbers. Each li
has a pre
tag filled with a line of code in it.
My problem is that when I set the width of the ol
, and I allow the overflow to scroll, the background color of the overflow is different than the background color of the area originally showing.
The background of the ol
has to be a different color than the background of the li
s to make the line numbers stand out.
Is there something wrong with my CSS, why is this happening? How can I have scrolling, and different background colors for line numbers and code?
HTML:
<ol class="code">
<li>
<pre>Hello World! This is a long line that you have to scroll to see.</pre>
</li>
<li>
<pre>This is the second line that you have to scroll to see.</pre>
</li>
</ol>
CSS:
ol {
width:200px;
background-color:#CFCFCF; }
pre {
color:#FFF;
background-color:#000; }
.code {
overflow:scroll; }
The problem: