Skip to main content

Color

ClassPropertySCSSHEX
.bx--snippet--singlebackground$ui-01#ffffff
.bx--snippet--singleborder$ui-03#dfe3e6
.bx--snippet__iconcolor$brand-01#3d70b2
.bx--snippet--inlinebackground-color$field-01#ffffff
.bx--snippet--inlinecolor$text-02#5a6872
.bx--snippet--inline:hoverbackground-color$hover-row#5596e6 at 10% opacity
.bx--snippet--lightbackground-color$field-02#f4f7fB
.bx--snippet--light:hoverbackground-color$ui-02#d0dced

Syntax colors

Carbon has defined a set of accessible syntax colors. View an incontext example on CodePen.

Typography

ClassFont-size (px/rem)Font-weightFont-family
.bx--snippet.code85% of body copy sizeNormal / 400Monospace
.bx--snippet.code85% of body copy sizeNormal / 400Monospace
.bx--snippet--inline.code85% of body copy sizeNormal / 400Monospace

Structure

Code snippet

ClassPropertypx / remSpacing token
.bx--snippet--singleheight56 / 3.5-
.bx--snippet--singlewidth (100%)600 / 37.5-
.bx--snippet--singlepadding-right40 / 2.5$spacing-2xl
.bx--snippet--singlepadding-left16 / 1$spacing-md

code snippet style 1 Structure and spacing measurements for code snippet | px / rem

Multi-line code snippet

ClassPropertypx / remSpacing token
.bx--snippet--multimin-height288 / 18-
.bx--snippet--multi .bx--snippet-containermax-heightVaries based on amount of content-
.bx--snippet--multiwidth600 / 37.5-
.bx--snippet--multipadding-top, padding-bottom16 / 1$spacing-md
.bx--snippet--multipadding-right48 / 3$spacing-3xl
.bx--snippet--multipadding-left24 / 1.5$spacing-lg
.bx--snippet__iconheight, width16 / 1-

code snippet style 2 Structure and spacing measurements for multi-line snippet | px / rem

Inline code snippet

ClassPropertypx / remSpacing token
.bx--snippet--inlinewidthVaries based on content-
.bx--snippet--inlineborder-radius4-
.bx--snippet--inline codepadding-right, padding-left8 / 0.5$spacing-xs

Structure and spacing measurements for inline code snippet | px / rem