Skip to content

Instantly share code, notes, and snippets.

@RichLewis007
Last active November 16, 2025 12:30
Show Gist options
  • Select an option

  • Save RichLewis007/a91355c68632a2408b38e5e172bf0193 to your computer and use it in GitHub Desktop.

Select an option

Save RichLewis007/a91355c68632a2408b38e5e172bf0193 to your computer and use it in GitHub Desktop.
In the OSS Obsidian notes program: CSS snippet to make boundary between editable note area and side whitespace clearly visible by adding subtle card shadow effect and thin outline.
/* Obsidian CSS snippet for the default theme, to make the editable area clearly separated from side whitespace */
/* Adjust these if you like */
:root {
--center-column-width: var(--file-line-width);
/* or 800px if you want fixed */
--center-column-padding: 24px;
}
/* Common "card" for both source and reading mode */
.markdown-source-view.mod-cm6 .cm-editor,
.markdown-reading-view .markdown-preview-section {
position: relative;
margin: 24px auto 32px auto;
max-width: var(--center-column-width);
padding: 16px var(--center-column-padding) 24px var(--center-column-padding);
border-radius: 10px;
}
/* Light theme card look */
.theme-light .markdown-source-view.mod-cm6 .cm-editor,
.theme-light .markdown-reading-view .markdown-preview-section {
background-color: rgba(0, 0, 0, 0.02);
box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.12),
0 16px 36px rgba(0, 0, 0, 0.08);
}
/* Dark theme card look */
.theme-dark .markdown-source-view.mod-cm6 .cm-editor,
.theme-dark .markdown-reading-view .markdown-preview-section {
background-color: rgba(255, 255, 255, 0.03);
box-shadow:
0 0 0 1px rgba(255, 255, 255, 0.12),
0 16px 36px rgba(0, 0, 0, 0.8);
}
/* Faint vertical rails at the exact left/right edge of the editable area */
.markdown-source-view.mod-cm6 .cm-editor::before,
.markdown-source-view.mod-cm6 .cm-editor::after,
.markdown-reading-view .markdown-preview-section::before,
.markdown-reading-view .markdown-preview-section::after {
content: "";
position: absolute;
top: 8px;
bottom: 8px;
width: 1px;
pointer-events: none;
opacity: 0.4;
}
/* Left rail */
.markdown-source-view.mod-cm6 .cm-editor::before,
.markdown-reading-view .markdown-preview-section::before {
left: 0;
background: linear-gradient(to bottom,
transparent,
rgba(128, 128, 128, 0.7),
transparent);
}
/* Right rail */
.markdown-source-view.mod-cm6 .cm-editor::after,
.markdown-reading-view .markdown-preview-section::after {
right: 0;
background: linear-gradient(to bottom,
transparent,
rgba(128, 128, 128, 0.7),
transparent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment