My question is not a repeat of Prevent line-break of span element, I need to simply underline part of a line of text.
The underlining is for marking of revisions to a piece of text. This is the standard method for the organization to mark revisions in all of their legal documents. It is not an option. I can't just say "I'll make this red text instead of underlining" or something like that. It MUST be underlined text.
The problem I am having is that when I use a span tag it forces a line break.
For example, I want ONLY "13" underlined in the below text:
4.13 The name of this Section is Foo.
If I use
<p class="textStyle_1">4.<span class="revMark">13 </span>Plug and Slot Welds</p>
Where the style in the span tag is:
.revMark {
text-decoration: underline;
}
I get this:
4.
13
The name of this Section is Foo.
(The 13 is underlined but I, obviously do not want the line breaks.)
If I use this style:
.revMark {
text-decoration: underline;
white-space: nowrap;
}
as suggested by the answer shown in the question above, I still get the line breaks.
I also tried using nowrap on the p tag, as in:
<p class="noWrapping">4.<span class="revMark">13 </span>Plug and Slot Welds</p>
Where the style are:
.revMark {
text-decoration: underline;
}
.noWrapping {
white-space: nowrap;
}
None of this works. I always get the line breaks. I even tried using the <u></u>
tag but it also produces line breaks.
I read on another site somewhere that Chrome has some sort of bug that causes it to ignore the nowrap in css. I don't know if that is true or not.
I have not tried it on any other browsers as my project is not going to be viewed on other browsers. It will be a desktop app built with Electron. Electron is built around Chromium, so if it looks wrong in Chrome it will look wrong in Electron.
UPDATE:
This seems to have something to do with grid layout. If I comment out display: inline-grid;
in the below css, the line breaks disappear. But removing that causes other problems with my grid layout.
.textStyle_1 {
display: inline-grid;
font-size: 12px;
font-weight: 400;
line-height: normal;
margin: 0px;
padding-top: 3px;
padding-right: 2px;
padding-bottom: 2px;
padding-left: 3px;
}