How to change the background color of a line of user input in a textarea?


Tags: css,input,textarea,background-color

Problem :

I know how to change the background color of a textarea, but what about changing the background color of the text that users type into a text area?

For example, in HTML you can change the background color of a span of text using span tags, ie:

<span style="background-color: blue">Words with blue background</span>

...But what about the text that users type into a text field?

I need to do this for a form that I'm creating, so that users can clearly see spaces and returns they're entering as well as the characters they enter.

Can it be done using CSS?



Solution :

No.

But there is the other way around. Did you ever used editor in github.com? It's cool. It uses javascript and <div> to control the style of each line of code. And translate.google.com uses the same way.


    CSS Howto..

    How do I use a sprite background image to display once on an element (no-repeat)?

    How to set a timer for CSS animation-timing-function?

    How to do transparent background on few div to see background of parent

    How to make better CSS ID rules

    Show image in a div tag with it's real size using jquery/css/html

    How to repeat multiple images over one element using CSS

    How to add a disabled internal Style node to HTML5 DOM?

    Bootstrap css, how to make always visible navbar-toggle?

    how to put image on button? (css)

    How is struts finding css files?

    How to separate css style from common to different statement

    How do I make a hamburger menu display on the right side?

    how to overlap two div in css?

    How to access the physical Bundled and Minified js / css created by BundleConfig class

    How to make flashing text in Css? [duplicate]

    how to get these two div's side by side in this container

    How to add “pause” button in this jquery slider?

    How to know where a CSS error occurred in dynamic content or how to stop the script upon CSS error

    CSS How to keep bodies of html file and included files from merging?

    How to put css and javascript in a common library/ project

    How can I create scrollable columns in Bootstrap?

    How can i make the responsive design using CSS?

    How to make the background image responsive

    How do I hover with text over div img?

    CSS - How to prevent ul/ol li's second row of text from going further left than the first line?

    How are table cell widths calculated in html?

    How to show a message box on center of screen?

    How to float 3 LI's to the left and 3 to the right and maintain original sequence?

    How to change url of image which is generated dynamically just by using CSS and media queries?

    how to make button in ionic + css