Jump to content

html/css not allowing text to scroll horizontally

Go to solution Solved by colonel_mortis,

It seems that white-space actually needs to be set to pre to allow multiple lines as in http://jsfiddle.net/BBTnr/2/ otherwise it wraps it all onto one line. Thanks for pointing me in the right direction. :D

I am making a website, and have some code tags. However, the code does not seem to work with the css

overflow: scroll

or

overflow: auto

As you can see in the image, the style is detected by the browser (Firefox running firebug in the screenshot but also on chrome), but not enabled. How can I make it allow scrolling code like it does in most places, including this forum?

OzXEzBh.png

HTTP/2 203

Link to post
Share on other sites

The code tag is an inline element. Set the display property to block, the overflow to auto. That will partially work, but it will then wrap at any spaces, so you'll also want to stop that. Example here: http://jsfiddle.net/BBTnr/

 

Edit: Actually, I checked the spec and remembered you're meant to surround it with pre tags for multiple lines (as you have done). Use this instead: http://jsfiddle.net/BBTnr/1/

Link to post
Share on other sites

It seems that white-space actually needs to be set to pre to allow multiple lines as in http://jsfiddle.net/BBTnr/2/ otherwise it wraps it all onto one line. Thanks for pointing me in the right direction. :D

Edited by colonel_mortis

HTTP/2 203

Link to post
Share on other sites

It seems that white-space actually needs to be set to pre to allow multiple lines as in http://jsfiddle.net/BBTnr/2/ otherwise it wraps it all onto one line. Thanks for pointing me in the right direction. :D

Ah, of course. You could also leave that out altogether though. I didn't actually test it with multiple lines.

Link to post
Share on other sites

Ah, of course. You could also leave that out altogether though. I didn't actually test it with multiple lines.

I'm using normalize.css which apparently defaults it to pre-wrap for some reason. :/

Thanks for the help

HTTP/2 203

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×