- This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I’d like to make my non-breaking spaces have a certain width (French punctuation), without resorting to font-size. Here’s what I tried:
span.sp-thin-fr {
display: inline-block;
width: 0.125em; /* 1/8 em */
}
…but display: inline-block;
overrides the non-breaking property.
Any ideas?
Not sure why it’s not working for you (or maybe I misunderstand). I do see some space between the last word and the period:
It’s working, but the space is treated as regular instead of non-breaking, so punctuation breaks of at the end of line.
That’s right, it’s as if there’s a normal space in html.
As I understand it. French punctuation is preceded by a space.
In this case a non-breaking space is required as there will be occasions when the very last item on the end would be the punctuation.
…and this would break.
Duh. I should’ve seen that.
Instead of giving it a width and display:inline-block;
just give it some horizontal padding.
The problem is it has to be narrower than a regular space, usually 1/8 of an em.
I could give it a negative margin, but there’s no way to calculate how much to get the exact width, since every font has a slightly different space.
The only option I see is to use the code from my original post and wrap everything in nowrap span, but that overloads the content with way too much markup.
It’s late to answer but the post is in good place in Google :
 
does a better job than
as it is narrower no-break space.