Question

In my blog the code tag within the pre tag doesn't scroll. Why?

HTML Code:

<pre class="source-code"><code>sudo apt-get install git cmake build-essential libgcrypt11-dev libjson0-dev libcurl4-openssl-dev libexpat1-dev libboost-filesystem-dev libboost-program-options-dev binutils-dev</code></pre>

Css:

pre.source-code {
  font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; 
  color: #000000;
  background-color: #eee;
  font-size: 12px;
  line-height: 14px;
  padding: 5px;
  overflow-x: scroll;
  width: 100%;
}
Was it helpful?

Solution

Use overflow-wrap: normal to prevent the line from automatically wrapping. Not sure why it was on word-break by default.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top