Is there a way to have a border that does increase the size of its div?
If the div height is 16px and border as border: solid 2px black;, I want the div height to remain at 16px and not increase to 18px (which occurs due to the border).
My requirement will not allow changing the div height to 14px.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
246 Points
471 Posts
How to have the border be inside of its div
Dec 19, 2016 10:24 PM|gunderj|LINK
Is there a way to have a border that does increase the size of its div?
If the div height is 16px and border as border: solid 2px black;, I want the div height to remain at 16px and not increase to 18px (which occurs due to the border).
My requirement will not allow changing the div height to 14px.
Thanks for any thought son this.
All-Star
57864 Points
15493 Posts
Re: How to have the border be inside of its div
Dec 20, 2016 01:37 AM|bruce (sqlwork.com)|LINK
box-sizing: border-box;
Star
8670 Points
2882 Posts
Re: How to have the border be inside of its div
Dec 20, 2016 09:41 AM|Cathy Zou|LINK
Hi, gunderj.
For your problem, as brue said, you could set box-sizing for Div.
Output In Chrome:
Best Regards
Cathy
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.