Logo Settings
Logo Settings
The site logo lives in <div id="logo">. Canvas supports multiple logo images in the same block so the correct one shows in different states: default, dark scheme, sticky header, and mobile. The Logo module reads which variants you included and generates the CSS to swap them automatically.
Standard markup
A minimal logo with just the default image:
<div id="logo">
<a href="index.html">
<img class="logo-default" srcset="images/logo.png, images/logo@2x.png 2x" src="images/logo@2x.png" alt="Canvas Logo">
</a>
</div>The srcset with the 2x descriptor is how Canvas serves a retina (high-DPI) logo. Provide a standard image and a @2x image that is exactly double the pixel size.
All logo variants
Add extra <img> tags with the variant classes and Canvas will show each one in the right context:
<div id="logo">
<a href="index.html">
<img class="logo-default" srcset="images/logo.png, images/logo@2x.png 2x" src="images/logo@2x.png" alt="Canvas Logo">
<img class="logo-dark" srcset="images/logo-dark.png, images/logo-dark@2x.png 2x" src="images/logo-dark@2x.png" alt="Canvas Logo">
<img class="logo-sticky" srcset="images/logo-sticky.png, images/logo-sticky@2x.png 2x" src="images/logo-sticky@2x.png" alt="Canvas Logo">
<img class="logo-mobile" srcset="images/logo-mobile.png, images/logo-mobile@2x.png 2x" src="images/logo-mobile@2x.png" alt="Canvas Logo">
</a>
</div>What each variant does
logo-defaultis the base logo, shown when no other state applies.logo-darkis shown when the header is in a dark scheme (inside.darkheader wraps). Add this so your logo stays visible on dark backgrounds.logo-stickyis shown once the header becomes sticky (.sticky-header). Use it if your sticky header has a different background.logo-sticky-shrinkis shown when a shrinking sticky header is active (.sticky-header-shrink).logo-mobileis shown on smaller screens where the expanded menu is not active. Handy for a compact or icon-only mark.
Tips
- You only need to include the variants you actually use. If you omit
logo-dark, Canvas simply keeps showing the default logo in dark headers. - Keep every variant the same height so the header does not jump when logos swap.
- The
alttext should describe your brand, not just say "logo", for better accessibility and SEO.
Usage
<div id="logo">
<a href="index.html">
<img class="logo-default" srcset="images/logo.png, images/logo@2x.png 2x" src="images/logo@2x.png" alt="Canvas Logo">
<img class="logo-dark" srcset="images/logo-dark.png, images/logo-dark@2x.png 2x" src="images/logo-dark@2x.png" alt="Canvas Logo">
</a>
</div>Extras
Retina Logo
Retina Logo
Serve a crisp logo on high-DPI (retina) screens using the standard srcset 2x descriptor. Canvas logos use this pattern out of the box.
<div id="logo">
<a href="index.html">
<img class="logo-default"
srcset="images/logo.png, images/logo@2x.png 2x"
src="images/logo@2x.png"
alt="Canvas Logo">
</a>
</div>Notes:
srcis the fallback for browsers that ignoresrcset; the2xentry is picked on retina/HiDPI displays.- Make
logo@2x.pngexactly twice the pixel dimensions oflogo.png, then constrain the display size with CSS or the image's intrinsic width so it renders at 1x size but 2x sharpness. - The same
srcsetapproach works for the dark, sticky and mobile logo variants:
<img class="logo-dark"
srcset="images/logo-dark.png, images/logo-dark@2x.png 2x"
src="images/logo-dark@2x.png" alt="Canvas Logo">Sticky Logo
Sticky Logo
Canvas can swap the logo image when the header becomes sticky (fixed on scroll). Add an <img class="logo-sticky"> inside #logo; the logo module writes the rules that show it once the header sticks.
<div id="logo">
<a href="index.html">
<img class="logo-default" src="images/logo.png" alt="Canvas Logo">
<img class="logo-sticky" src="images/logo-sticky.png" alt="Canvas Logo">
</a>
</div>How it works:
logo.jsdetects.logo-stickyand adds: on.sticky-header #logothe default logo is hidden and.logo-stickyis shown.- The
sticky-headerclass is applied to the header wrap automatically when the sticky header engages on scroll. - For a shrinking sticky header, also add
<img class="logo-sticky-shrink">; it is shown when the body hassticky-header-shrink. - These variants combine freely with
.logo-darkand.logo-mobilein the same#logoelement; each is handled by its own generated rule.
Mobile Logo
Mobile Logo
Canvas can swap the logo image on smaller screens (before the menu expands to desktop). Add a second <img class="logo-mobile"> inside #logo; the logo module injects the CSS that hides the default logo and shows the mobile one whenever the body is not in expanded-menu mode.
<div id="logo">
<a href="index.html" class="standard-logo">
<img class="logo-default" src="images/logo.png" alt="Canvas Logo">
<img class="logo-mobile" src="images/logo-mobile.png" alt="Canvas Mobile Logo">
</a>
</div>How it works:
- The
logo.jsmodule detects.logo-mobileand writes a rule: onbody:not(.is-expanded-menu)the standard logo ([class^="logo-"]) is hidden and.logo-mobileis shown. .is-expanded-menuis added when the viewport is at or above yourdata-menu-breakpoint(set on<body>, for exampledata-menu-breakpoint="1200"). Below it, the mobile logo takes over.- You can stack this with
.logo-dark,.logo-stickyand.logo-sticky-shrinkin the same#logoblock; each is handled independently.
