Skip to content

Instantly share code, notes, and snippets.

@kobitoDevelopment
Last active May 9, 2025 13:13
Show Gist options
  • Save kobitoDevelopment/7fc572c01478fcfb29965e32483e0be3 to your computer and use it in GitHub Desktop.
Save kobitoDevelopment/7fc572c01478fcfb29965e32483e0be3 to your computer and use it in GitHub Desktop.
/* 省略記号(…)だけに特定のフォント(Arial)を適用するためのフォント定義 */
@font-face {
font-family: 'ellipsis'; /* フォントファミリー名を "ellipsis" とする */
src: local("Arial"); /* ローカルの Arial フォントを使用 */
unicode-range: U+2026; /* Unicode 2026(…)だけをこのフォントで描画 */
}
div {
width: 200px;
text-overflow: ellipsis; /* コンテンツがオーバーしたら "…" を表示 */
overflow: hidden;
white-space: nowrap;
/*
フォントファミリーの優先順位を指定。
"ellipsis" は省略記号(…)だけに適用され、それ以外の文字は次のフォントにフォールバック。
これにより、テキストは和文フォントで表示されつつ、
自動で追加される省略記号だけが欧文フォント(Arial)で表示される。
*/
font-family: ellipsis, sans-serif;
}
<div>
sample sample sample sample sample sample sample sample sample
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment