Creating a PRE text area with scroll bar

I actually had this issue on Dev-Notes.com for a little while. To get around it, I changed the style class for code so it looks like the following:

pre.code {
	overflow: auto; 
	overflow-y: visible;
}

With this, when encountered with a long line of code, a horizontal scroll bar will appear to allow the user to scroll left and right instead of breaking the width and sometimes positioning of the parent DIV. Below is a demo of this CSS style.

BufferedWriter out = new BufferedWriter(new FileWriter("/folder/anotherFolder/thirdFolder/anotherFolderToMakeThisLineLong/file.txt"));

Leave a Reply

Your email address will not be published.