Specifying a style that never has line breaks

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
Fiona
Sr. Propeller Head
Posts: 117
Joined: Tue Jan 27, 2015 7:44 am
Location: U.K.

Specifying a style that never has line breaks

Post by Fiona »

We use a lot of code in our documentation. The code includes Unicode symbols and punctuation, for example: "1 2 3+.×10 12 14"

I do not want this to break accross lines as the meaning is lost. I know how to tell Flare to not break where there's a space, but I want to say that if something like the example expression is entered in a particuklar style, don't break anywhere (currently it is breaking after the ".", and I can't stop it). Although I can fudge this for the PDF output (hideously clunky and not ideal or future-proof), the resizable HTML5 output means that this is not an option.

Does anyone have a .css suggestion for sorting this problem?

Thanks. Fiona
kel322
Propeller Head
Posts: 34
Joined: Tue Jan 03, 2017 12:56 pm

Re: Specifying a style that never has line breaks

Post by kel322 »

Hello,
I've been having a similar issue where we have icons within the text, sometimes followed by a period. The line will break before the period, starting the next line with a period. Non-breaking space doesn't work because we don't want a space before the period.

Anyway, I recently discovered the white-space property in css, which can take nowrap, normal, and pre as values. You want the nowrap value. So far, it has worked for me.

I set up a span class and wrap it around the content that I want to keep together on a line:

span.noBreak {
white-space: nowrap;
}

<span class = "noBreak">1 2 3+.×10 12 14</span>

Hope this helps!
Kelly
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Specifying a style that never has line breaks

Post by ChoccieMuffin »

What output are you thinking of? It may be possible (for an online output at least) to include a div to contain your code, which has a horizontal scroll bar. If you have a long bit of code your user will have to use the scrollbar in the topic to scroll all the way over and you might not like that. What do you want it to look like if that's not suitable?
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Fiona
Sr. Propeller Head
Posts: 117
Joined: Tue Jan 27, 2015 7:44 am
Location: U.K.

Re: Specifying a style that never has line breaks

Post by Fiona »

Thanks Kelly; I've already tried that but maybe I didn't get it quite correct so I'll have another go.

ChoccieMuffin, I want this to be future-proof so work in any output. Currently we only output to PDF and HTML5 but we're looking at ePub and maybe others too. I really don't want to go the way of div and scrollbars!
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Specifying a style that never has line breaks

Post by ChoccieMuffin »

Fiona wrote:Thanks Kelly; I've already tried that but maybe I didn't get it quite correct so I'll have another go.

ChoccieMuffin, I want this to be future-proof so work in any output. Currently we only output to PDF and HTML5 but we're looking at ePub and maybe others too. I really don't want to go the way of div and scrollbars!
So how CAN you have a long line of text that never breaks if your long line is wider than your page? I just can't visualise what it'd look like.

I think I'm imagining that you've got a looooooong line of code, 80+ characters, that's in its own paragraph, which is why I got confused - sorry! Do you ONLY mean having a little bit of text in the middle of a paragraph that's got a "CODE" span on it? I'll have a think and see if I can come up with anything you can add to your span to make it non-breaking anywhere. (Another yuck is there is no such thing as a non-breaking underline, so I share your pain.)
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Fiona
Sr. Propeller Head
Posts: 117
Joined: Tue Jan 27, 2015 7:44 am
Location: U.K.

Re: Specifying a style that never has line breaks

Post by Fiona »

ChoccieMuffin, the bits of code I'm talking about are typically less than 20 characters; I agree that for a line greater than the width of the text block it would be necessary to have a break (or scrollbars in the online version).
Post Reply