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
Asked
Active
Viewed 1.4k times
3
-
Try writing same CSS for textarea. – Richa Jul 01 '14 at 11:26
-
Did you checked this link http://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize – G.L.P Jul 01 '14 at 12:11
3 Answers
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,129
- 9
- 24
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
- 4,240
- 5
- 33
- 50
-
you checked that in firebug? see my update in answer. try writing `!important` after every property. – Richa Jul 01 '14 at 11:54
-
-
apparently it's ok. I'm using IE9 and checked with F12, and it is showing the CSS configurations as they should appear on screen... but sadly they aren't – Filipe Vilhena Jul 01 '14 at 12:57