Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5988303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:56:22+00:00 2026-05-22T22:56:22+00:00

I have a textarea that contains code. The problem is, that in order for

  • 0

I have a textarea that contains code. The problem is, that in order for it to look good, the Textarea has to stop wrapping the text, and use a Horizontal Scrollbar instead.

I tried this:

textarea
{
    overflow: scroll;
    overflow-y: scroll;
    overflow-x: scroll;
    overflow:-moz-scrollbars-horizontal;

}

and this:

textarea
{

    overflow: auto;
    overflow-y: scroll;
    overflow-x: scroll;
    overflow:-moz-scrollbars-horizontal;

}

However the Horizontal Scrollbar is not applying.

What is the correct way of doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:56:22+00:00Added an answer on May 22, 2026 at 10:56 pm

    Set the wrap attribute to off

    <textarea wrap="off"></textarea>
    

    Demo: http://jsfiddle.net/wesley_murch/HZkLK/

    There is also a soft and hard value for wrap. The only decent reference on this I found on tizag.com, although there must be better ones out there. From the linked page:

    The wrap attribute refers to how the
    text reacts when it reaches the end of
    each row in the text field. Wrapping
    can be one of three settings:

    soft
    hard
    off
    

    Soft forces the words to wrap once
    inside the text area but when the form
    is submitted, the words will no longer
    appear as such (Line breaks will not
    be added).

    Hard wraps the words inside the text
    box and places line breaks at the end
    of each line so that when the form is
    submitted it appears exactly as it
    does in the text box.

    Off sets a textarea to ignore all
    wrapping and places the text into one
    ongoing line.

    I’m not sure about HTML5, but this won’t validate in XHTML or HTML4 (the validator tells me: there is no attribute “WRAP”), but it does certainly seem to work in the following browsers I checked:

    • Firefox 4
    • IE6, IE7, IE8
    • Chrome 10
    • Opera 11
    • Safari 5.0.3

    I don’t think this can be done cross-browser with CSS. I was coming up short trying to find official docs/support for this, and when I did find something useful, it was here on Stack Overflow!

    See this answer for more details:

    How remove word wrap from textarea?

    However, the CSS solution provided there is not working for me on Firefox 4…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that contains multiple textarea elements. These textareas and the IDs
I have a div that contains the value of the textarea on keyup, so
I have saved input from a textarea element to a TEXT column in MySQL.
I have a form with a textarea. Users enter a block of text which
I have the following snippet of code, changeTextArea is a TextArea object. changeTextArea.addKeyboardListener(new KeyboardListenerAdapter()
I have a form in an MVC view which contains a number of text
I have a site that lists several upcoming events, and each event has a
I'm using a HTML form's TEXTAREA field that will contain text and it may
I have a textarea with many lines of input, and a JavaScript event fires
For my small wiki application, I mostly need to have the textarea used to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.