I have uploaded multiple .txt files in a file upload field. The files have multiple columns which I do not want to wrap when displayed.
In views I would like to create a list of these files. When I click on a file I would like to view the .txt file in a fixed width window so that the browser doesn't wrap the lines on a small display device.
Is there a .txt formatter for views?
Or a way to force a browser not to wrap the lines on a small display? Forced horizontal scrolling would be great.

Comments

gausarts’s picture

I am not aware of such formatter, but you may want to use a simple .html, not a plain .txt, to take advantage of CSS white-space property.

Wrap each file contents with a single DIV/ P, say with a class "nowrap", then add the CSS rule:

.nowrap {
  white-space: nowrap;
}

You need to add a linebreak at each line, if using P tag at each line is not an option.
See demo below:

11111111111111111111111111 22222222222222222222222222 3333333333333333333 4444444444444444444 555555555555555555555555555 666666666666666666666666 777777777777777777777777777 88888888888888888888
11111111111111111111111111 22222222222222222222222222 3333333333333333333 4444444444444444444 555555555555555555555555555 666666666666666666666666 777777777777777777777777777 88888888888888888888

love, light n laughter