How do i set width for the codebox (PrismJS)

288 Views Asked by At

So i am basically trying to set width for the codebox (i am using prismJS), when i add too big of a code it breaks everything and the width and height get increased. I want the width and height to be specified so if the code is too long it just adds a scrollbar.

This is how big i want the codebox to be: pic

<div class="container">
    <div class="post-header">SOME HEADER</div>
  
    <div class="post-content">
  
      <p> <pre><code class="language-js">
        
      </code></pre>
        <p>
        
  
    <img class="image-content">
    <div class="post-content">
      
    </div>
  </div>
2

There are 2 best solutions below

2
Haim Abeles On

You need to add a CSS property to your code box

overflow: scroll;
0
Gamer-XyZ On

added<div style="height:200px;width:800px;overflow:auto"> next to pre tag, that seems to have fixed the issue.