# Bad value X for attribute “size” on element “input”: Zero is not a positive integer.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-size-on-element-input-zero-is-not-a-positive-integer
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `size` attribute on an `<input>` element must be a whole number greater than zero, so `size="0"` is invalid.

`size` sets the visible width of a text field, counted in characters. It applies to the `text`, `search`, `url`, `tel`, `email` and `password` input types. The HTML standard requires a valid non-negative integer greater than zero, and browsers ignore a zero value and render the field at their default width of about 20 characters. Any value that parses to zero, such as `0` or `00`, produces this error.

Templates and CMS search modules often write `size="0"` to mean "no fixed width" and leave the sizing to CSS. The attribute has no such meaning, so the zero only adds an error to the page.

Remove the attribute when CSS sets the width of the field, or set it to the number of characters that should be visible, such as `size="30"`. The `size` attribute does not limit how much text the user can type; `maxlength` does that.

## Invalid example

```html
<form action="/search">
  <label for="q">Search</label>
  <input type="text" id="q" name="q" size="0">
</form>
```

## Valid example

```html
<form action="/search">
  <label for="q">Search</label>
  <input type="text" id="q" name="q" size="30">
</form>
```
