Email or username:

Password:

Forgot your password?
Stefan Judis

CSS quick tip: if you're adding quotation characters use `open-quote` and `close-quote` as content because they consider the document language. 💪

stefanjudis.com/today-i-learne

Code example showing that `content: open-quote` and `content: close-quote` are localized.
14 comments
alster
@stefan TIL: That languages do use different quotes,w hile I thought all languages use simply " " and the rst is just different styling.
Will Boyd

@stefan oh hey thanks for the shout-out! 🙂

David Larlet

@stefan @HTeuMeuLeu the `quote` parameter car also be handy to add non-breaking spaces, for instance in French:

[lang=fr] {
/* « » « » (non-breaking spaces added) */
--q-quotes: '\00ab\202F' '\202F\00bb' '\00ab\202F' '\202F\00bb';
}
q {
quotes: var(--q-quotes);
}
q::before {
content: open-quote;
}
q::after {
content: close-quote;
}

Also, there is quite a list there github.com/jensimmons/cssremed

#typonerd

@stefan @HTeuMeuLeu the `quote` parameter car also be handy to add non-breaking spaces, for instance in French:

[lang=fr] {
/* « » « » (non-breaking spaces added) */
--q-quotes: '\00ab\202F' '\202F\00bb' '\00ab\202F' '\202F\00bb';
}
q {
quotes: var(--q-quotes);
}
q::before {
content: open-quote;
}
q::after {
content: close-quote;
}

Lea Rosema

@stefan learned something new, thank you 😍

Sebastian LaVine

@stefan I've played around with these before, but doesn't this mean that when highlighting text to copy, the quotes aren't highlighted? At least in my testing. Since the text isn't actually part of the content

Eana Hufwe

@smlavine@fosstodon.org @stefan@front-end.social Firefox seems to have hard coded an exception to insert an ASCII " for any regardless of languages, while Chrome does nothing as if these are just simple CSS pseudo elements.

There’s a proposal to make these quotation marks copyable.
https://github.com/whatwg/html/issues/10216

papush
@stefan i'm still angered tho
(but nice tip)
« Salut!
»
chrysn

@stefan Some (waving at @jyasskin) disagree with the advice to use <q>. I'm leaning more towards "fix the browser", but be aware: hachyderm.io/@jyasskin/1121303

Go Up