I am having a problem with the width of a code block I have inside of a list element. This list element is set by JavaScript, as it is used with Swipejs, to the width of the page.
However, the problem I have is that when the <pre>
element has got a large block of text on a single line that surpasses the width of the parent, the list element expands. My question would be how can I prevent this from happening and force the <pre>
element to have a set width to the <li>
width while having overflow:scroll
?
<li>
<pre class="language-css"><code class="language-css">
</code></pre>
</li>
I am aware that this can be done by defining a specific fixed width to the <pre>
element but as it should work with different screen sizes, this is not possible. I hope you can help. Thanks!