CSS snippets let you style Grid and Masonry views in ways the plugin's settings don't cover.

To learn more about snippets, including how to add one to your vault, refer to CSS snippets.

Use Obsidian's variables

Cards take their colors, fonts, and spacing from Obsidian's own CSS variables, so a theme or snippet that changes them changes the cards too. For example, this snippet changes Obsidian's normal text color, which card titles use too, in the light and dark color schemes:

.theme-light {
  --text-normal: #2e3440;
}

.theme-dark {
  --text-normal: #e5e9f0;
}

Variables

Dynamic Views also has variables of its own. Set them on body to change every view, or on a class of your own to change one view. For more information, refer to Style a single view.

Cards

VariableDefaultDescription
--dynamic-views-card-border-radius8pxCard corner radius. Images at the card's edge follow it.
--dynamic-views-card-padding8pxSpace between the card's edge and its content.
--dynamic-views-path-separator-padding0.15emSpace on either side of the / between folder names in a path.
--dynamic-views-icon-shadowTwo soft dark drop shadowsShadow behind icons drawn over images, such as the URL button. Takes a filter value, such as none.
--dynamic-views-embedded-heightThe view's Embedded heightMaximum height of a base in a note, in place of the view's Embedded height. none removes the limit.

Images

Thumbnail

VariableDefaultDescription
--dynamic-views-thumbnail-border-radius4pxCorner radius.
--dynamic-views-thumbnail-crop-positioncenterWith Fit set to Crop, which part of the image stays in view, such as top.
--dynamic-views-thumbnail-contain-positioncenterWith Fit set to Contain, where the image sits in its box, such as top.

Cover

VariableDefaultDescription
--dynamic-views-cover-border-radius0pxCorner radius where the cover meets the card's content.
--dynamic-views-cover-inset0pxSpace between the card's edge and the cover.
--dynamic-views-left-right-cover-height150pxMinimum height of a card with the cover on the left or right.
--dynamic-views-cover-crop-positioncenterWith Fit set to Crop, which part of the image stays in view, such as top.
--dynamic-views-cover-contain-positioncenterWith Fit set to Contain, where the image sits in its box, such as top.

Poster

VariableDefaultDescription
--dynamic-views-poster-crop-positioncenterWith Fit set to Crop, which part of the image stays in view, such as top.
--dynamic-views-poster-contain-positioncenterWith Fit set to Contain, where the image sits in its box, such as top.
--dynamic-views-poster-overlay-blur3pxWith the Overlay display mode, blur of the poster while its details show over it. 0px turns it off.
--dynamic-views-poster-overlay-dark70With the Overlay display mode, how much a dark tint darkens the poster while its details show, in percent.
--dynamic-views-poster-overlay-light70With the Overlay display mode, how much a light tint lightens the poster while its details show, in percent.

Backdrop

VariableDefaultDescription
--dynamic-views-backdrop-crop-positioncenterWhich part of the image stays in view, such as top.
--dynamic-views-backdrop-overlay-dark60How much a dark tint darkens the backdrop, in percent.
--dynamic-views-backdrop-overlay-light70How much a light tint lightens the backdrop, in percent.
--dynamic-views-backdrop-overlay-blur0pxBlur of the backdrop.

Classes you can target

ClassWhat it styles
.cardCard
.card-titleCard title
.card-title-iconIcon from the Icon property
.card-title-extFile type badge
.card-subtitleCard subtitle
.card-text-previewText preview
.propertyProperty row
.property-name-inlineProperty name inline with the value
.property-name-aboveProperty name above the value
.property-valueProperty value
.card-cover, .card-thumbnail, .card-poster, .card-backdropImage, by image format
.card-url-buttonURL button

To style only one image format, start the selector with its class on the card: .image-format-cover, .image-format-thumbnail, .image-format-poster, or .image-format-backdrop. To style only one layout, start it with [data-view-type="dynamic-views-grid"] or [data-view-type="dynamic-views-masonry"].

Style a single view

To apply a snippet to one view only, give that view a class of its own. In the View settings, under CSS classes, enter a class name, for example reading-list.

Then start each selector in your snippet with that class:

.reading-list .card-title {
  font-family: serif;
}

The class goes on the view's own container, so the snippet only changes cards in that view.

Example

This snippet gives every card rounder corners and more space inside, keeps the top of cover images in view, and sets titles in a serif font in one view:

body {
  --dynamic-views-card-border-radius: 16px;
  --dynamic-views-card-padding: 12px;
  --dynamic-views-cover-crop-position: top;
}

.reading-list .card-title {
  font-family: serif;
}