Is there a way of making a Textarea NOT wrap? [SOLVED]

0 favourites
  • 3 posts
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
  • I've added a scripting language to a project, so naturally dropped a Text area in for debugging and quickly throwing scripts around. The parser can output errors, and give me line numbers for those errors in the script. However, with wrapping on it's awkward to work out line numbers. I think I've exhausted styling options with CSS, as wrapping is traditionally handled from the HTML end of things apparently.

    So there we have it: does anyone know how to disable wrapping on a Textarea?

    [ Edit: An alternative question, as this is the longer way I see of getting line numbers: How can I specify a width for a textarea in characters, ie: columns? I know this can be specified in HTML, and should be specifyable by setting the CSS 'width' property to '40em' or whatever. Setting the width works, but even with all padding etc specifically set to 0, the width is waaaay over the specified value. ]

    [Edit 2: Solved. It turns out if you set the CSS 'white-space' to 'nowrap' it works. I actually discovered this by being told it didn't work, and trying it anyway - which just goes to show... something.]

  • white-space: pre might be a better alternative, otherwise some browser might not preserve the white-space info.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oh! The white-space is significant, thank you for the heads-up! After I solved the problem yesterday my scripts started to get a little longer, and I'd like to add line numbers proper now. Any ideas?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)