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 9019369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:45:36+00:00 2026-06-16T04:45:36+00:00

I have this html and css: http://jsfiddle.net/b7rDL/6/ HTML: <div class=text-block contenteditable=true spellcheck=false>Some Text</div> css:

  • 0

I have this html and css: http://jsfiddle.net/b7rDL/6/

HTML:

<div class="text-block" contenteditable="true" spellcheck="false">Some Text</div>

css:

.text-block {
    resize: none;
    font-size:40px;
    border: none;
    line-height: 1;
    -moz-appearance: textfield-multiline;
    -webkit-appearance: textarea;
    min-width: 30px;
    overflow: visible;
    white-space: nowrap;
    display: inline-block;
}

This code allows me to write text with no width limit or height limit. It displays no scroll bar and it grows with the text. Those are basically the features I need.

  1. How can I convert this to regular textarea that will act the same? I want this to work on browser that doesn’t implemented “contenteditable”. Therefore I want to replace the div with textarea or other basiv element. How can I do it? (I don’t mind using JavaScript).
  2. How can I disable the spellchecker? spellcheck=false doesn’t work. In the example, when I focus on the text box, I get that buggy red line. I am using Firefox.
  3. How can I get rid of the border when I am focused? – SOLVED

I don’t mind using JavaScript to solve those issues.

Any answer for those questions will help me.

Thanks

UPDATES:
@Oylex helped me with 3

  • 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-06-16T04:45:38+00:00Added an answer on June 16, 2026 at 4:45 am

    I was having trouble figuring out the bounds of the textarea‘s content, so with this approach I’m copying the content of the textarea into a similarly styled p element, which is set to float: left; and then resizing the textarea based on the size of the p. This handles both width and height.

    I’ve tested on Mac 10.8.1 FF 18.0, Safari 6.0, Chrome 25.0.1362.0 canary, iOS Safari 6.0.1 and iOS Simulator 5.1 (272.21). I don’t have a PC or IE handy.

    http://jsfiddle.net/b7rDL/34/

    HTML

    <textarea id="tx" class="text-block" spellcheck="false"></textarea>
    <p id="dupe" class="text-block"></p>
    

    CSS

    .text-block {
        font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
        resize: none;
        font-size:14px;
        border: none;
        line-height: 1;
        min-width: 30px;
        overflow: hidden;
        white-space: pre;
        display: block;
        outline: none;
        width: 30px;
        height: auto;
        border: 1px solid #ddd;
        background-color: #f7f7f7;
    }
    
    #dupe {
        float: left;
        display: none;
        width: auto;
        height: auto;
    }
    

    I added a background and border so I could see what’s going on.

    JavaScript

    // no `var` so they are global and easier to work
    // with in the inspector when using jsFiddle
    
    $tx = $('#tx');
    $dupe = $('#dupe');
    lineH = Number($tx.css('line-height').replace('px',''));
    
    update();
    
    $tx.on('keydown', function() {
        setTimeout(update, 0);
    });
    $tx.on('propertychange input keyup change', update);
    
    function update() {
        $dupe.text($tx.val());
        $tx.css({
            width: $dupe.width() + 7,
            height: $dupe.height() + lineH
        });
    }
    
    // not sure if this is needed, leaving it because
    // I don't have many browsers to test on
     $tx.on('scroll', function() {
         tx.scrollLeft = 0;
         tx.scrollTop = 0;
     });
    

    I’m adding extra space on the right and at the bottom because it seems to perform more consistently that way. Also, in the HTML, the wrap="off" is necessary for the version of Firefox, I’m using.

    I got some good tips from this blog post.

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

Sidebar

Related Questions

I have this html with css: http://jsfiddle.net/krhxG/ I set the width of the div
I have this example: http://jsfiddle.net/WkpL9/ HTML: <div class=span2> <div class=image-container> <img alt= src=http://placehold.it/150x120/> <p>asdadsadasdasdsadasdasdasdasdsadsad</p>
I have this jQuery and HTML http://jsfiddle.net/UgX3u/30/ <div class=container> <div class=yellow></div> <div class=red></div> <div
I have the following code: http://jsfiddle.net/cosoroaba/nCEwv/ HTML: <div id=square> <div class=corner-wrapper> <div id=ctr></div> </div>
I have this css http://jsfiddle.net/thiswolf/3GYY4/ and beneath each text input,i want to have some
I have this css3 transition code: http://jsfiddle.net/uRxKg/ CSS: body, html { height: 100%; margin:
Using this really simple html / css ( http://jsfiddle.net/XXzTj/ ) <div style=background-color:red;> <div style=margin:12px;
I have this html: <div class=foo parent> <div class=child></div> </div> with some css: .foo{
I have an HTML CSS Query. I have the following JS Fiddle. http://jsfiddle.net/NC9NL/ If
I have the following code in HTML/CSS: http://jsfiddle.net/XmRNh/ As you can see, there is

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.