# Bad value X for attribute “size” on element “input”: Expected a digit but saw Y instead.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-size-on-element-input-expected-a-digit-but-saw-y-instead
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `size` attribute of an `<input>` takes digits only, and a value like `32/` usually means a self-closing slash got glued onto an unquoted value, as in `<input size=32/>`.

`size` sets the visible width of a text field in characters, and the HTML standard requires a valid non-negative integer greater than zero: one or more digits with nothing else around them. The character after "saw" in the message is the first one that isn't a digit. A `/` points to the slash problem, `p` to a CSS unit as in `32px`, and a blank to a stray space inside the quotes.

An unquoted attribute value runs until the next space or `>`, so in `<input size=32/>` the slash becomes part of the value. The trailing slash on a void element like `<input>` does nothing in HTML anyway. Remove it, or quote the value (`size="32"`) so the slash stays outside it. For widths in pixels or other units, set them with the CSS `width` property instead of `size`.

## Invalid example

```html
<label for="q">Search</label>
<input type=text id=q name=q size=32/>
```

## Valid example

```html
<label for="q">Search</label>
<input type="text" id="q" name="q" size="32">
```
