I have an html input.
The input has padding: 5px 10px;
I want it to be 100% of the parent div's width(which is fluid).
However using width: 100%;
causes the input to be 100% + 20px
how can I get around this?
I have an html input.
The input has padding: 5px 10px;
I want it to be 100% of the parent div's width(which is fluid).
However using width: 100%;
causes the input to be 100% + 20px
how can I get around this?
Use css calc()
Super simple and awesome.
As seen here: Div width 100% minus fixed amount of pixels
By webvitaly (https://stackoverflow.com/users/713523/webvitaly)
Original source: http://web-profile.com.ua/css/dev/css-width-100prc-minus-100px/
Just copied this over here, because I almost missed it in the other thread.
Assuming i'm in a container with 15px padding, this is what i always use for the inner part:
That will stretch the inner part to whatever width it should be less the 15px either side.
Cheers
Andy