css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h1>CSS currentColor Example</h1>
<p>This is an example for <code>currentColor</code> property for an <a href="https://hashnode.com/post/writing-better-css-with-currentcolor-cit5mgva31co79c53ia20vetq">article on hashnode</a><p>

<p>CurrentColor can have many interesting implementations, here are few examples:</p>

<div class="demo-div">Keeping the CSS clean even with <a href="#">links</a> and SVGs(
  <svg viewBox="0 0 300 300"><use xlink:href="#icon-1"></use></svg>
  <svg viewBox="0 0 300 300"><use xlink:href="#icon-2"></use></svg>
  <svg viewBox="0 0 300 300"><use xlink:href="#icon-3"></use></svg>) in the code</div>

<div class="demo-div">
  currentColor also works with psuedo elements, even with <a class="tooltip-link tooltip-1" data-text="Tooltip" href="#">Different</a> <a class="tooltip-link tooltip-2" data-text="Tooltip" href="#">Colors</a>
</div>
<div class="shadow-div">
  <p>currentColor also works with <b>box-shadow</b>,<b>borders</b> and <b>hover styles</b></p>
  <p>and can be <b>Overriden</b> <i>dynamically</i></p>
</div>
<div class="demo-div gradient">
  <p>The background gradient in this section is made using currentColor</p>
</div>

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display: none;">
  <defs>
    <symbol id="icon-1" viewBox="0 0 300 300">
      <g>
			<path d="M149.996,0C67.157,0,0.001,67.161,0.001,149.997S67.157,300,149.996,300s150.003-67.163,150.003-150.003     S232.835,0,149.996,0z M109.368,100.055c0-21.018,17.1-38.115,38.115-38.115s38.115,17.099,38.115,38.115v45.782     c0,21.016-17.1,38.113-38.115,38.113c-21.015,0-38.115-17.1-38.115-38.113V100.055z M209.384,147.282     c0,31.662-23.905,57.832-54.613,61.452v20.915h12.802v15.562H126.41v-15.562h12.802v-21.042     c-30.231-4.056-53.628-30.003-53.628-61.328v-21.742h15.562v21.742c0,25.549,20.788,46.334,46.337,46.334     s46.34-20.788,46.34-46.334v-21.742h15.562C209.384,125.537,209.384,147.282,209.384,147.282z"/>
			<path d="M147.483,168.391c12.436,0,22.554-10.115,22.554-22.551v-12.991h-45.108v12.991     C124.929,158.274,135.047,168.391,147.483,168.391z"/>
		</g>
    </symbol>
    <symbol id="icon-2" viewBox="0 0 300 300">
      <g><path d="M149.996,0C67.157,0,0.001,67.161,0.001,149.997S67.157,300,149.996,300s150.003-67.163,150.003-150.003    S232.835,0,149.996,0z M149.303,204.044h-0.002v-0.001c0,3.418-1.95,6.536-5.021,8.03c-1.24,0.602-2.578,0.903-3.909,0.903    c-1.961,0-3.903-0.648-5.506-1.901l-29.289-22.945c-1.354,0.335-2.767,0.537-4.235,0.537h-29.35    c-9.627,0-17.431-7.807-17.431-17.429v-50.837c0-9.625,7.804-17.431,17.431-17.431h29.352c1.707,0,3.348,0.257,4.912,0.711    l28.612-22.424c2.684-2.106,6.344-2.492,9.415-0.999c3.071,1.494,5.021,4.609,5.021,8.027V204.044z M178.616,167.361l-9.788-9.788    c2.256-3.084,3.608-6.87,3.608-10.979c0-4.536-1.631-8.699-4.331-11.936l9.713-9.713c5.177,5.745,8.362,13.323,8.362,21.649    C186.177,154.492,183.331,161.733,178.616,167.361z M191.307,180.054c7.944-8.901,12.781-20.624,12.781-33.46    c0-13.264-5.166-25.334-13.585-34.334l9.716-9.716c10.903,11.495,17.613,26.997,17.613,44.049c0,16.625-6.37,31.792-16.793,43.188    L191.307,180.054z M224.385,212.84l-9.713-9.716c13.793-14.846,22.25-34.715,22.25-56.532c0-22.243-8.797-42.454-23.073-57.393    l9.716-9.713c16.762,17.429,27.098,41.075,27.098,67.106C250.664,172.201,240.663,195.502,224.385,212.84z"/>
	</g>
    </symbol>
    <symbol id="icon-3" viewBox="0 0 300 300">
      <g xmlns="http://www.w3.org/2000/svg">
			<path d="M149.996,0C67.157,0,0.001,67.161,0.001,149.997S67.157,300,149.996,300s150.003-67.163,150.003-150.003     S232.835,0,149.996,0z M226.946,224.021L226.946,224.021c-0.001,8.593-6.97,15.562-15.563,15.562H88.622     c-8.593,0-15.562-6.969-15.562-15.562V75.323c0-8.593,6.969-15.562,15.562-15.562h122.762c8.593,0,15.562,6.969,15.562,15.562     V224.021z"/>
			<path d="M183.261,161.5h-66.52c-3.919,0-7.091,3.177-7.091,7.091v41.272c0,3.919,3.175,7.091,7.091,7.091h66.52     c3.919,0,7.091-3.175,7.091-7.091v-41.272C190.355,164.674,187.18,161.5,183.261,161.5z"/>
			<rect x="84.775" y="112.932" width="13.401" height="15.562"/>
			<rect x="84.775" y="83.646" width="13.401" height="15.562"/>
			<rect x="84.775" y="200.793" width="13.401" height="15.562"/>
			<rect x="84.775" y="171.506" width="13.401" height="15.562"/>
			<rect x="84.775" y="142.219" width="13.401" height="15.562"/>
			<path d="M183.261,82.396h-66.52c-3.919,0-7.091,3.177-7.091,7.091v41.272c0,3.919,3.175,7.091,7.091,7.091h66.52     c3.919,0,7.091-3.175,7.091-7.091V89.486C190.355,85.57,187.18,82.396,183.261,82.396z"/>
			<rect x="201.92" y="83.646" width="13.401" height="15.562"/>
			<rect x="201.92" y="200.793" width="13.401" height="15.562"/>
			<rect x="201.92" y="112.932" width="13.401" height="15.562"/>
			<rect x="201.92" y="171.506" width="13.401" height="15.562"/>
			<rect x="201.92" y="142.219" width="13.401" height="15.562"/>
		</g>
    </symbol>
  </defs>
</svg>
            
          
!
            
              body {
  color: #333;
}
p, a, svg {
  color: currentColor;
  fill: currentColor;
}
a {
  border-bottom: 1px solid currentColor;
}
.shadow-div {
  color: #EC974B;
  border: 2px solid currentColor;
  box-shadow: 0 0 14px -1px currentColor;
}
.shadow-div:hover {
  color: #A08BCD;
}
.tooltip-1 {
  color: purple;
}
.tooltip-2 {
  color: tomato;
}
.tooltip-link:after {
  color: currentColor;
  border: 1px solid currentColor;
}
.demo-div.gradient {
  color: #CADBEC;
  background: linear-gradient(to bottom right,currentColor,#2BC2F1);
}


/* Additional Styles for layout */
body {
  font-family: arial;
  font-size: 16px;
  margin: 0;
  padding: 24px;
  background: #CADBEC;
}
a {
  text-decoration: none;
}
.demo-div, .shadow-div {
  background: #FAFAFA;
  width: 100%;
  max-width: 560px;
  padding: 14px;
  border-radius: 8px;
  margin: 30px auto;
  text-align: center;
  transition: all 300ms ease-in-out;
}
.demo-div {
  background: #FAFAFA;
  border: 1px solid #7FA1C2;
}
.shadow-div {
  cursor: pointer;
}
.tooltip-link {
  position: relative;
}
.tooltip-link:after {
  position: absolute;
  left: 0;
  top: -8px;
  opacity: 0;
  content: attr(data-text);
  transition: 200ms ease-in-out;
  padding: 4px 8px;
  border-radius: 3px;
  background: #FFFFFF;
}
.tooltip-link:hover:after {
  opacity: 1;
  transform: translateY(-100%);
}
.demo-div.gradient {
  margin-bottom: 0;
}
.demo-div.gradient p {
  color: #333;
}
svg {
    display: inline-block;
    width: 18px;
    height: 18px;
    position: relative;
    top: 4px;
    margin: 0;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console