Skip to content

Instantly share code, notes, and snippets.

@shivampip
Last active February 3, 2020 18:45
Show Gist options
  • Select an option

  • Save shivampip/f37077c8db33df26898b808ef72600bf to your computer and use it in GitHub Desktop.

Select an option

Save shivampip/f37077c8db33df26898b808ef72600bf to your computer and use it in GitHub Desktop.
Div inside div with 100% height/width and padding/margin

By setting this property with the value "border-box" it makes whichever element you apply it to not stretch when you add a padding or border. If you define something with 100px width, and 10px padding, it will still be 100px wide.

box-sizing: border-box;  // on parent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment