0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Obsidian】h2タグに端っこまで下線を引く!【CSS】

0
Last updated at Posted at 2026-08-07

はじめに

最近Obsidianを使い始めました。
前々からメモを外部のサーバーに上げたくないと思っていたので、出会えてHAPPYです。
このqiitaもそうですが、
h2タグ(## )の装飾は幅いっぱいに下線があるのが基本なイメージがあり、
Obsidianで書いたときも幅いっぱいに下線を表示したくなりました。

(本題)下線を引く

余計なのはなし。下線を引くのみです!
.obsidian/snippets/style.cssに以下コピペして、
設定>外観>SCCスニペットから読み込めは完成!

body {
  --line-color: rgba(128,128,128,1);
}
/* リーディングモード */
.markdown-rendered h2{
  border-bottom: solid 2px var(--line-color)
}

/* ライブプレビューモード */
.HyperMD-header-2 {
  border-bottom: solid 2px var(--line-color)
}

↓ライブプレビューモードも、プレビューも両対応しています。
(画像はライブプレビュー)
image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?