Reputation: 31
Imagine that I have a textarea in HTML. The code would look something like this:
<textarea rows="4" cols="100" id="i" CLASS="A"></textarea>
How can I change the font and font size? And is it possible to have multiple different font sizes and fonts in there?
Upvotes: 0
Views: 92
Reputation: 5564
You can style the textarea
just like any other element with CSS. Whether you want to do it in an external stylesheet, internal stylesheet, or with inline style is up to you.
As for your second question, I'm not sure what your use case is, but it is not possible with HTML or CSS alone. You'll need JavaScript.
div {
font-family: serif;
font-size: 1.5rem;
color: blue;
}
.textbox {
font-family: monospace;
font-size: 3rem;
color: red;
}
<div>i'm a div</div>
<textarea class='textbox' rows="4" cols="100" id="i" CLASS="A">i'm a textarea</textarea>
Upvotes: 1
Reputation: 2683
The easyest way is to do this with the style
attribute
<textarea rows="4" cols="100" id="i" CLASS="A" style="font-size:30px;font-family:courier"></textarea>
Upvotes: 0