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 :


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

    CSS Howto..

    How can I select my font awesome icons in CSS?

    How to make button in unordered list “highlight” by adding a border on click?

    How to fade loop background images in Twitter's Bootstrap 3

    How to apply CSS style which will be ignored for tfoot or last TR

    How to make IFrame fill width of screen

    How to use css transform-origin to show a circle of playing cards (rectangles)?

    How to control the size of a table cell in css

    how to fit an image inside a box and vertical align it

    css code how to put the navigation in the middle

    Can someone explain in detail how the clear works in this code?

    How to handle this CSS mouse hover issue?

    How do I deal with the issue of my divs being distorted greatly when zoomed in?

    How to double an image size in HTML using only CSS?

    How to have dynamic image as CSS background?

    Ideas with how to draw a specific large amount of circles on a page using a loop

    How to build this layout with CSS?

    How to remove top border for one element in a list

    how to make an odd shaped html/css menu?

    how to disable drupal7 system css files?

    HTML/CSS: How to get the id of sub menu

    How does reddit create the top header without any margins?

    How do I (by default) style different types of labels differently?

    How to style every odd p element after h2 element occured in css?

    How do you keep zoom between pages consistent? via CSS?

    How do I design my CSS with ASP.NET MVC?

    How to set the select to have the width of the selected option

    css - I've got a nested floating div, how do I get it to fill the entire 100%?

    how can I make my image (down arrow) disappear when I start scrolling my page?

    Django-Bower + Foundation 5 + SASS, How to configure?

    How to change textbox style in css