Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>Canva Button styling with SVG icons</h1>
<p>SVG are inlined as an example, they can be served in any convenient way. CSS class names are just an example too.</p>
<table>
  <tr>
    <th></th>
    <th>Large size</th>
    <th>Default (normal) size</th>
    <th>Small size</th>
    <th>Tiny size</th>
  </tr>
  <tr>
    <th>Default theme</th>
    <td>
      <span class="canva-btn canva-btn-theme-default canva-btn-size-l">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
    <td>
      <span class="canva-btn canva-btn-theme-default canva-btn-size-m">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
    <td>
      <span class="canva-btn canva-btn-theme-default canva-btn-size-s">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
    <td>
      <span class="canva-btn canva-btn-theme-default canva-btn-size-xs">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
  </tr>
    <tr>
    <th>Dark theme</th>
    <td>
      <span class="canva-btn canva-btn-theme-dark canva-btn-size-l">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
    <td>
      <span class="canva-btn canva-btn-theme-dark canva-btn-size-m">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
    <td>
      <span class="canva-btn canva-btn-theme-dark canva-btn-size-s">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
    <td>
      <span class="canva-btn canva-btn-theme-dark canva-btn-size-xs">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
  </tr>
    </tr>
    <tr>
    <th>Light theme</th>
    <td>
      <span class="canva-btn canva-btn-theme-light canva-btn-size-l">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
    <td>
      <span class="canva-btn canva-btn-theme-light canva-btn-size-m">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
    <td>
      <span class="canva-btn canva-btn-theme-light canva-btn-size-s">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
    <td>
      <span class="canva-btn canva-btn-theme-light canva-btn-size-xs">
        <span class="canva-btn-i"></span>
        Design with Canva
      </span>
    </td>
  </tr>
</table>

              
            
!

CSS

              
                .canva-btn {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-smooth: always;
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  line-height: 1.6;
  box-sizing: border-box;
  user-select: none;
  cursor: pointer;
  border: 1px solid transparent;
  max-width: 100%;
  min-width: 80px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  white-space: nowrap;
  transition: background-color 0.1s linear;
}

.canva-btn-i {
  background-size: contain;
}

.canva-btn-theme-default {
  background-color: #7D2AE8;
  color: #ffffff;
}

.canva-btn-theme-default:hover,
.canva-btn-theme-default:focus {
  background-color: #8D39FA;
}
 
.canva-btn-theme-default:active {
  background-color: #6718CF;
}

.canva-btn-theme-dark {
    background-color: #0E1318;
    color: #ffffff;
}

.canva-btn-theme-dark:hover,
.canva-btn-theme-dark:focus {
  background-color: #565A5D;
}

.canva-btn-theme-dark:active {
  background-color: #707477;
}

.canva-btn-theme-light {
  border-color: #9A9DA3;
  background-color: #ffffff;
  color: #0e1318;
}

.canva-btn-theme-light:hover,
.canva-btn-theme-light:focus  {
  background-color: #F3F3F3;
}

.canva-btn-theme-light:active {
  background-color: #E7E7E8;
}

.canva-btn-size-l {
  height: 48px;
  border-radius: 5px;
  font-size: 16px;
  padding-right: 16px;
}

.canva-btn-size-l .canva-btn-i {
  width: 32px;
  height: 32px;
  margin-left: 11px;
  margin-right: 13px;
}

.canva-btn-size-m {
  height: 40px;
  border-radius: 4px;
  font-size: 14px;
  padding-right: 16px;
}

.canva-btn-size-m .canva-btn-i {
  width: 24px;
  height: 24px;
  margin: 0 9px;
}

.canva-btn-size-s {
  height: 32px;
  border-radius: 3px;
  font-size: 12px;
  padding-right: 12px;
}

.canva-btn-size-s .canva-btn-i {
  width: 20px;
  height: 20px;
  margin: 0 8px;
}

.canva-btn-size-xs {
  height: 24px;
  border-radius: 2px;
  font-size: 12px;
  padding-right: 8px;
}

.canva-btn-size-xs .canva-btn-i {
  width: 16px;
  height: 16px;
  margin-left: 6px;
  margin-right: 5px;
}


/* SVG files are inlined here just as an example. If you're going to use Canva logo in SVG format on your website, you can host SVG files and use them in CSS using URL in `background-image: url(...)`; */
  
.canva-btn-theme-default .canva-btn-i {
filter: drop-shadow(3px 3px 4px rgba(0, 0, 0, 0.1));
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='12' cy='12' r='12' fill='%235A32FA'/%3e%3ccircle cx='12' cy='12' r='12' fill='url(%23paint0_radial)'/%3e%3ccircle cx='12' cy='12' r='12' fill='url(%23paint1_radial)'/%3e%3ccircle cx='12' cy='12' r='12' fill='url(%23paint2_radial)'/%3e%3ccircle cx='12' cy='12' r='12' fill='url(%23paint3_radial)'/%3e%3cpath d='M17.1807 14.4617C17.0816 14.4617 16.9945 14.5452 16.9038 14.7279C15.8797 16.8047 14.1108 18.2741 12.0637 18.2741C9.69682 18.2741 8.23108 16.1375 8.23108 13.1857C8.23108 8.18574 11.0169 5.29483 13.4638 5.29483C14.6073 5.29483 15.3056 6.01338 15.3056 7.15685C15.3056 8.51398 14.5345 9.23252 14.5345 9.71116C14.5345 9.92601 14.6682 10.0561 14.9332 10.0561C15.9979 10.0561 17.2476 8.83267 17.2476 7.10433C17.2476 5.42851 15.789 4.19672 13.3421 4.19672C9.29816 4.19672 5.70422 7.94582 5.70422 13.1332C5.70422 17.1485 7.99713 19.8019 11.535 19.8019C15.29 19.8019 17.4612 16.0659 17.4612 14.8532C17.4612 14.5846 17.3239 14.4617 17.1807 14.4617Z' fill='white'/%3e%3cdefs%3e%3cradialGradient id='paint0_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(4.63579 21.2716) rotate(-49.4156) scale(18.5619)'%3e%3cstop stop-color='%235A32FA'/%3e%3cstop offset='1' stop-color='%235A32FA' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint1_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(6.35368 2.72842) rotate(54.7035) scale(20.9321)'%3e%3cstop stop-color='%2300C4CC'/%3e%3cstop offset='1' stop-color='%2300C4CC' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint2_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(4.63579 21.2716) rotate(-45.1954) scale(18.3372 8.43355)'%3e%3cstop stop-color='%235A32FA'/%3e%3cstop offset='1' stop-color='%235A32FA' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint3_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(7 3) rotate(62.4472) scale(25.9422 43.459)'%3e%3cstop stop-color='%2300C4CC' stop-opacity='0.725916'/%3e%3cstop offset='0.0001' stop-color='%2300C4CC'/%3e%3cstop offset='1' stop-color='%2300C4CC' stop-opacity='0'/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e ");
}

.canva-btn-theme-dark .canva-btn-i,
.canva-btn-theme-light .canva-btn-i {
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='1900' height='1900' viewBox='0 0 1900 1900' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='950' cy='950' r='950' fill='%237D2AE7'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint0_radial)'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint1_radial)'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint2_radial)'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint3_radial)'/%3e%3cpath d='M1360.14 1144.88C1352.3 1144.88 1345.4 1151.5 1338.22 1165.96C1257.14 1330.37 1117.1 1446.7 955.046 1446.7C767.666 1446.7 651.627 1277.55 651.627 1043.87C651.627 648.036 872.175 419.173 1065.89 419.173C1156.41 419.173 1211.69 476.058 1211.69 566.583C1211.69 674.022 1150.65 730.907 1150.65 768.799C1150.65 785.808 1161.23 796.107 1182.21 796.107C1266.5 796.107 1365.43 699.252 1365.43 562.425C1365.43 429.756 1249.96 332.239 1056.25 332.239C736.105 332.239 451.585 629.043 451.585 1039.71C451.585 1357.59 633.107 1567.65 913.186 1567.65C1210.46 1567.65 1382.35 1271.88 1382.35 1175.88C1382.35 1154.62 1371.48 1144.88 1360.14 1144.88Z' fill='white'/%3e%3cdefs%3e%3cradialGradient id='paint0_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(367 1684) rotate(-49.4156) scale(1469.49)'%3e%3cstop stop-color='%236420FF'/%3e%3cstop offset='1' stop-color='%236420FF' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint1_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(503 216) rotate(54.7035) scale(1657.12)'%3e%3cstop stop-color='%2300C4CC'/%3e%3cstop offset='1' stop-color='%2300C4CC' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint2_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(367 1684) rotate(-45.1954) scale(1451.7 667.656)'%3e%3cstop stop-color='%236420FF'/%3e%3cstop offset='1' stop-color='%236420FF' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint3_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(777 256) rotate(66.5198) scale(1495.86 2505.9)'%3e%3cstop stop-color='%2300C4CC' stop-opacity='0.725916'/%3e%3cstop offset='0.0001' stop-color='%2300C4CC'/%3e%3cstop offset='1' stop-color='%2300C4CC' stop-opacity='0'/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e"); 
}

.canva-btn-theme-dark:hover .canva-btn-i,
.canva-btn-theme-dark:focus .canva-btn-i,
.canva-btn-theme-light:hover .canva-btn-i,
.canva-btn-theme-light:focus .canva-btn-i {
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='1900' height='1900' viewBox='0 0 1900 1900' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='950' cy='950' r='950' fill='%237D2AE7'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint0_radial)'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint1_radial)'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint2_radial)'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint3_radial)'/%3e%3cpath d='M1360.14 1144.88C1352.3 1144.88 1345.4 1151.5 1338.22 1165.96C1257.14 1330.37 1117.1 1446.7 955.046 1446.7C767.666 1446.7 651.627 1277.55 651.627 1043.87C651.627 648.036 872.175 419.173 1065.89 419.173C1156.41 419.173 1211.69 476.058 1211.69 566.583C1211.69 674.022 1150.65 730.907 1150.65 768.799C1150.65 785.808 1161.23 796.107 1182.21 796.107C1266.5 796.107 1365.43 699.252 1365.43 562.425C1365.43 429.756 1249.96 332.239 1056.25 332.239C736.105 332.239 451.585 629.043 451.585 1039.71C451.585 1357.59 633.107 1567.65 913.186 1567.65C1210.46 1567.65 1382.35 1271.88 1382.35 1175.88C1382.35 1154.62 1371.48 1144.88 1360.14 1144.88Z' fill='white'/%3e%3cdefs%3e%3cradialGradient id='paint0_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(367 1684) rotate(-49.4156) scale(1469.49)'%3e%3cstop stop-color='%236420FF'/%3e%3cstop offset='1' stop-color='%236420FF' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint1_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(503 216) rotate(54.7035) scale(1657.12)'%3e%3cstop stop-color='%2300C4CC'/%3e%3cstop offset='1' stop-color='%2300C4CC' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint2_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(367 1684) rotate(-45.1954) scale(1451.7 667.656)'%3e%3cstop stop-color='%236420FF'/%3e%3cstop offset='1' stop-color='%236420FF' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint3_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(777 256) rotate(66.5198) scale(1495.86 2505.9)'%3e%3cstop stop-color='%2300C4CC' stop-opacity='0.725916'/%3e%3cstop offset='0.0001' stop-color='%2300C4CC'/%3e%3cstop offset='1' stop-color='%2300C4CC' stop-opacity='0'/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e");

}

.canva-btn-theme-dark:active .canva-btn-i,
.canva-btn-theme-light:active .canva-btn-i {
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='1900' height='1900' viewBox='0 0 1900 1900' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='950' cy='950' r='950' fill='%237D2AE7'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint0_radial)'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint1_radial)'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint2_radial)'/%3e%3ccircle cx='950' cy='950' r='950' fill='url(%23paint3_radial)'/%3e%3cpath d='M1360.14 1144.88C1352.3 1144.88 1345.4 1151.5 1338.22 1165.96C1257.14 1330.37 1117.1 1446.7 955.046 1446.7C767.666 1446.7 651.627 1277.55 651.627 1043.87C651.627 648.036 872.175 419.173 1065.89 419.173C1156.41 419.173 1211.69 476.058 1211.69 566.583C1211.69 674.022 1150.65 730.907 1150.65 768.799C1150.65 785.808 1161.23 796.107 1182.21 796.107C1266.5 796.107 1365.43 699.252 1365.43 562.425C1365.43 429.756 1249.96 332.239 1056.25 332.239C736.105 332.239 451.585 629.043 451.585 1039.71C451.585 1357.59 633.107 1567.65 913.186 1567.65C1210.46 1567.65 1382.35 1271.88 1382.35 1175.88C1382.35 1154.62 1371.48 1144.88 1360.14 1144.88Z' fill='white'/%3e%3cdefs%3e%3cradialGradient id='paint0_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(367 1684) rotate(-49.4156) scale(1469.49)'%3e%3cstop stop-color='%236420FF'/%3e%3cstop offset='1' stop-color='%236420FF' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint1_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(503 216) rotate(54.7035) scale(1657.12)'%3e%3cstop stop-color='%2300C4CC'/%3e%3cstop offset='1' stop-color='%2300C4CC' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint2_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(367 1684) rotate(-45.1954) scale(1451.7 667.656)'%3e%3cstop stop-color='%236420FF'/%3e%3cstop offset='1' stop-color='%236420FF' stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient id='paint3_radial' cx='0' cy='0' r='1' gradientUnits='userSpaceOnUse' gradientTransform='translate(777 256) rotate(66.5198) scale(1495.86 2505.9)'%3e%3cstop stop-color='%2300C4CC' stop-opacity='0.725916'/%3e%3cstop offset='0.0001' stop-color='%2300C4CC'/%3e%3cstop offset='1' stop-color='%2300C4CC' stop-opacity='0'/%3e%3c/radialGradient%3e%3c/defs%3e%3c/svg%3e");
}
              
            
!

JS

              
                
              
            
!
999px

Console