By default body
and html
are assigned to margin
or padding
to some pixels. Try using following code.
1vh = 1% of veiwport height
100vh = 100% of height.
So never calculate height – 3px. like this
body,html {
margin: 0;
padding: 0;
}
* {
box-sizing: border-box;
}
More Related Contents:
- Border Gradient with Border Radius
- Is there a CSS selector by class prefix?
- Position Relative vs Absolute?
- Remove padding from columns in Bootstrap 3
- External CSS vs inline style performance difference?
- How to store inherit value inside a CSS variable (aka custom property)?
- Freeze screen in chrome debugger / DevTools panel for popover inspection?
- Modify twitter bootstrap navbar
- Can I have multiple :before pseudo-elements for the same element?
- CSS Text orientation : vertically oriented to the right
- Webfont Smoothing and Antialiasing in Firefox and Opera
- CSS Pseudo Element Counters: can you increment an alphabet letter “a”, “b”, “c”, etc instead of a number?
- Select nth-child across multiple parents
- How can I remove the gloss on a select element in Safari on Mac?
- CSS media queries min-width and min-device-width conflicting?
- How to set height property for SPAN
- How can I transition height: 0; to height: auto; using CSS?
- Is there a “subgrid” feature, to position “grandchildren” of a grid container?
- how to rotate text left 90 degree and cell size is adjusted according to text in html
- CSS fill remaining width
- Fading out text at bottom of a section with transparent div, but height stays under section after overlaying div
- How to style the UL list to a single line
- Align button at the bottom of div using CSS
- text flowing out of div
- Can I set the height of a div based on a percentage-based width? [duplicate]
- Is it bad practice to prefix single lines of CSS with // as a personal comment style?
- css to make bootstrap navbar transparent
- Chrome & Safari Error::Not allowed to load local resource: file:///D:/CSS/Style.css
- Ellipsis in flexbox container [duplicate]
- CSS Double Border with outer border thicker than inner border