3

I have a project with several textboxes and need some of them to become Multiline. But the problem is, when I set them Multiline I lose all my CSS styles. I've searched around and found out that textbox turns into TextArea on runtime, is Multiline is selected. Although, I'm still looking for a way to keep or overwrite somehow the CSS to keep my backcolor, size and preferred font

Filipe Vilhena
  • 55
  • 1
  • 2
  • 10

3 Answers3

7

I don't really understand what you mean. Multiline Textboxes are Textareas, but thats not set on runtime. You have to expand your css selection and add textarea.

I don't know if that is what you are looking for, but I just made an example on jsfiddle: http://jsfiddle.net/N79fj/1/

HTML:

<form action="#" method="post">
    <input type="text" name="test" /><br /> <!-- Textbox -->
    <textarea name="textarea" cols="30" rows="5"></textarea> <!-- Textarea (Multiline) -->
</form>

CSS:

input[type="text"], textarea {
    background-color: #000;
    color: #fff;
    font-family: Arial;
}
Yannici
  • 736
  • 5
  • 17
0

Try changing your CSS so that instead of it applying to input[type=text] it applies to textarea.

Also change your actual HTML to make the "multiline" textboxes into TextArea's.

I'm also slightly confused what you mean by "runtime". There is no run-time in HTML/CSS web pages?

Jakob
  • 1,109
  • 9
  • 20
0

CSS

.textArea { 
  background: #ccc !important; 
  font-size:12px !important; 
 } /*change css properties as you want*/

Apply this class on your multi line textbox with class="textArea" attribute.

richa_pandey
  • 4,210
  • 3
  • 31
  • 48