Pushan
Pushan

Reputation: 119

html text box size adjustment

I am a php programmer. I am not able to decrease the size of a few text boxes in my html form, they are in the same .

Upvotes: 1

Views: 16078

Answers (4)

Nitesh Patel
Nitesh Patel

Reputation: 1

You also can write this way,

<html>
<head>
<style type="text/css">
input[type=text] {height:50px;width:200px;}
</style>
</head>
<body>
<input type="text" />
</body>

Upvotes: 0

Jeff
Jeff

Reputation: 193

Read these examples - http://www.w3schools.com/css/css_reference.asp#dimension

<html>
<head>
    <style type="text/css">
       input {height:100px; width:200px; }
    </style>
</head>
<body>
        <input type="text" />
</body>

In this case all html "input types" would have height 100x and width 200px. Instead if you use a "class" you style only those elements which are assigned that specific class.

<html>
<head>
    <style type="text/css">
        .tb {height:100px; width:200px; }
    </style>
</head>
<body>
<input type="text" class="tb"/>
<br />
<input type="text" />
</body>

You can also use an "id" for that specific html element. Ids should be unique in an html page

<html>
<head>
    <style type="text/css">
        #tb {height:100px; width:200px; }
    </style>
</head>
<body>
<input type="text" id="tb"/>
<br />
<input type="text" />
</body>

Upvotes: 2

Gavin Klein
Gavin Klein

Reputation: 1

You can also specify the rows and cols attributes of the textareas to control their size. Rows are the horizontal lines and cols is the number of characters wide you want the texarea to be

<textarea name="myText" rows="10" cols="80">Enter some text</textarea>

Provides a fairly short and wide textarea.

Upvotes: -1

Jimmy Cleveland
Jimmy Cleveland

Reputation: 151

If you are using CSS, a simple width and height property work just fine.

textarea {height:100px; width:100px; }

Upvotes: 0

Related Questions