Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the size of input fields be set to percent values?

Tags:

html

css

input

I am unable to create an input field which covers 80% of the width of the browser window while being centered.

<input style="margin-right:10%; margin-left:10%;" size="100%">

only works when the browser is maximized.

like image 749
user2084795 Avatar asked Feb 18 '13 21:02

user2084795


People also ask

Can you use percentages in CSS?

The <percentage> CSS data type represents a percentage value. It is often used to define a size as relative to an element's parent object. Numerous properties can use percentages, such as width , height , margin , padding , and font-size . Note: Only calculated values can be inherited.

How do you change the size of the input type number?

The size attribute specifies the visible width, in characters, of an <input> element. Note: The size attribute works with the following input types: text, search, tel, url, email, and password. Tip: To specify the maximum number of characters allowed in the <input> element, use the maxlength attribute.

How do you change the input field height?

If you want to increase the height of the input field, you can specify line-height css property for the input field.

What is the value of an input field?

The value attribute specifies the value of an <input> element. The value attribute is used differently for different input types: For "button", "reset", and "submit" - it defines the text on the button. For "text", "password", and "hidden" - it defines the initial (default) value of the input field.


1 Answers

Try this

<input type="text" id="url" NAME="otherSite" style="width:70%" value=""/>
like image 116
Naveen D Almeida Avatar answered Sep 30 '22 14:09

Naveen D Almeida