DEV Community

Cover image for Best CSS Reset
Vishal Vansjariya
Vishal Vansjariya

Posted on • Edited on

Best CSS Reset

A CSS Reset style is a list of rules that 'reset' all of the default browser styles.

This CSS reset style is not standard, although any CSS reset is not standard. I followed this CSS reset most of the time. This reset has my personal touch, so this is very subjective.

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
  font: inherit;
}

::-moz-selection {
  background-color: #b3d4fc;
  color: #000000;
  text-shadow: none;
}

::selection {
  background-color: #b3d4fc;
  color: #000000;
  text-shadow: none;
}

html {
  font-size: 62.5%;
  scroll-behavior: smooth;
  height: 100%;
}

html,
body {
  min-height: 100%;
}

ul,
ol {
  list-style: none;
}

a {
  color: inherit;
  display: inline-block;
  text-decoration: none;
}

svg {
  display: inline-block;
  max-width: 100%;
}

img,
picture,
video,
canvas {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  border-radius: 0;
  border: none;
  background-color: transparent;
}

input,
textarea,
select {
  color: inherit;
  letter-spacing: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeSpeed;
  font-size: 1.6rem;
}

Enter fullscreen mode Exit fullscreen mode

Here is my github repository for the CSS reset stylesheet. if you like give it a star and follow.

Resources
https://www.joshwcomeau.com/css/custom-css-reset/
https://piccalil.li/blog/a-modern-css-reset/

Top comments (0)