Reputation: 157
I'm designing an application for mobile in which I am trying to change the size of html text element. But "size" attribute is not showing any impact. How can I do the same?
Thanks in advance.
Upvotes: 1
Views: 7626
Reputation: 145398
To change the size dynamically, use the css()
method from jQuery:
$("#element").css({
width: 100,
height: 100
});
Or another way without jQuery:
with (document.getElementById("element").style) {
width = "100px";
height = "100px";
}
To set static size use CSS width
and height
properties.
Upvotes: 1
Reputation: 929
HTML
<input type="text" class="input-text" />
CSS
.input-text
{
width:300px;
height:30px;
font:Verdana, Geneva, sans-serif;
font-size:30px;
}
Upvotes: 0
Reputation: 490243
The size
attribute is an ancient relic.
Use CSS to define the input
element's dimensions.
Upvotes: 0