Donnerstag, 2. Mai 2019

Make use of the "zero width no-break space" character

There's one character in Unicode I really like: The zero width no-break spaceor . I use it for giving an element the line height it would have, would it contain text but when it should in fact stay empty - e.g. for vertically aligning an input field in a row with other input field, where the one in question does not have a label text above it.

Simply use the escaped unicode form in CSS adding a pseudo element:

.zero-width-no-break-space::before {
    content: '\FEFF';
}

Keine Kommentare:

Kommentar veröffentlichen