In my page, there are several input
and select
tags.
I use width:100%;
to define their width, but the width in the browser is not 100%
.
I used the debug tool in chrome, and found there is also useragent stylesheet styles applied.
How can I make the width 100%?
or use the following css:
Try to use the width CSS property of select tag as follows:
So the same for the input tag
You can use the style in css as well for input tag.
To override the user agent stylesheet use reset.css in your code at the start.
If you do not want to override the useragent then you can go for width value in 'px'
Demo Fiddle
You should ideally separate style from content, so in your CSS include:
nb. demo fiddle without box-sizing set
And you need to use
box-sizing:border-box
in order for sizing to take into account any browser specific or set margin/padding/borders. Here's a handy read on the subject.Box-Sizing on MDN: