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?

More than 5 years have passed since last update.

CGMにパワポがコピペされた時にフォントサイズ指定を無効化するCSS

Posted at

CGM開発に関わるフロントエンジニアは、勝手気ままにWordやパワポをコピペしてフロントコードが荒らされることに辟易してる方も多いと思います。私もです。

システムやエディタ側で余分なHTMLを除去すべきととは思いますが、そこはコストと優先度の話。最低限のコストでしれっと改修できる、CSSのみで対応する方法のメモです。

CSS

span {
  font-size: inherit !important;
}

これだけ。
全体に及ぶと問題あるなら以下のように出力コンテンツ枠を対象にしても良いでしょう。

.output span {
  font-size: inherit !important;
}

パワポはspanタグにfont-sizeを埋め込んでくるので、これで一括してベースのフォントサイズに調整できます。

色も適当に設定されるのを避けるなら、以下のようにしても良いでしょう。

span {
  font-size: inherit !important;
  color: inherit !important;
}

表示だけはこれで対応できますが、WordやパワポのコピペはHTMLに汚いインラインCSSが残りまくるので、本質的にはそれを除去したいですね…

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?