Jitender Chand
Jitender Chand

Reputation: 93

input type checkbox size not working

ie browser has a checkbox alignment problem actully ie take default size of checkbox which is width 20px and height 20px but other browser does not take this property so i want to change the size of input box

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<style >

*{margin:0px; height:0}
.jitu {width:40px; height:40px;}

</style>


</head>

<body>

<input type="checkbox" class="jitu" size="10" />


</body>
</html>

Upvotes: 3

Views: 6441

Answers (3)

bignose
bignose

Reputation: 32307

i want to change the size of input box

You have misunderstood what the size attribute specifies for an input. It is not a specifier of physical length; it is a specifier of how many characters of input data is shown on the control.

From the HTML specification for the size attribute for input:

The size attribute gives the number of characters that, in a visual rendering, the user agent is to allow the user to see while editing the element's value.

The checkbox input type does not recognise a size specification, because the data doesn't have different sizes.

To change the appearance of the element, you need to alter its style using CSS.

Upvotes: 0

Vivek Chandra
Vivek Chandra

Reputation: 4358

put the check box in the container and give the height/width to that contianer..

*{margin:0px; height:0}
.jitu {width:40px; height:40px;}


<div class="jitu">
<input type="checkbox"  size="10" />
</div>

Once you've set the height and width of the container -- you can place the checkbox where ever you want withing the container.. with margin for the checkbox..

Upvotes: 0

xkeshav
xkeshav

Reputation: 54022

Clearly Quotes

size

The initial size of the control. This value is in pixels unless the value of the type attribute is text or password, in which case, it is an integer number of characters. Starting in HTML5, this attribute applies only when the type attribute is set to text, search, tel, url,email, or password;
otherwise it is ignored. In addition, the size must be greater than zero. If you don't specify a size, a default value of 20 is used.

Upvotes: 1

Related Questions