首页 > 代码库 > [CSS] Easily Reset Styles With a Single CSS value

[CSS] Easily Reset Styles With a Single CSS value

There are times where you need to reset a an element’s styles. Instead of overwriting it with even more style declarations, you can simply reset them.

 

/* Styles go here */body {  color: #d200ff;}button {  color: white;  font-size: 14px;  background: lightgreen;  text-align: center;  border: none;  padding: 10px 20px;}section {  font-size: 16px;}section button {  color: unset; /*since section doesn‘t have color set, will use body color*/  font-size: unset; /*use section font-size*/}

 

 

<iframe style="width: 100%; height: 200px;" src="https://embed.plnkr.co/gS0FK5PxJW5I1r1yK0zf/" width="320" height="240"></iframe>

[CSS] Easily Reset Styles With a Single CSS value