Keeping words together

F

Fons Rave

How can I force the browsers to keep words together. E.g. "abc def ghi"
must always be on one line. So no break between "abc" and "def". It
should move to a new line as one part.
I found out I can force using #255 instead of SPACE (#32). But I don't
really like that.

Thanks,
Fons.
 
I

ironcorona

Fons said:
How can I force the browsers to keep words together. E.g. "abc def ghi"
must always be on one line. So no break between "abc" and "def". It
should move to a new line as one part.
I found out I can force using #255 instead of SPACE (#32). But I don't
really like that.

The non-breaking space
abc def ghi
 
M

Mimic

Fons said:
How can I force the browsers to keep words together. E.g. "abc def ghi"
must always be on one line. So no break between "abc" and "def". It
should move to a new line as one part.
I found out I can force using #255 instead of SPACE (#32). But I don't
really like that.

Thanks,
Fons.

<pre> ?

--
Mimic

"I'd rather reign in Hell, than serve in Heaven".

[email: ZGF0YWZsZXhAY2FubmFiaXNtYWlsLmNvbQ==]
Help Stop Spam - www.hidemyemail.net

"I have come to realise that, only in death, will I find true perfection."
 
J

Jim Moe

Fons said:
How can I force the browsers to keep words together. E.g. "abc def ghi"
must always be on one line. So no break between "abc" and "def". It
should move to a new line as one part.
Options:
1. Use &nbsp; instead of " ".
2. Use <span style="white-space:nowrap">abc def ghi</span>.
 
F

Fons Rave

All thanks for the help.
Options:
1. Use &nbsp; instead of " ".
2. Use <span style="white-space:nowrap">abc def ghi</span>.

I tried &nbsp before. Probably in a wrong way. Maybe the "span style" is
the best; is longer but, I think, gives the HTML a better readabillity.

Fons.
 
M

Michael Hedinger

Fons said:
How can I force the browsers to keep words together. E.g. "abc def ghi"
must always be on one line. So no break between "abc" and "def". It
should move to a new line as one part.
I found out I can force using #255 instead of SPACE (#32). But I don't
really like that.

Thanks,
Fons.

I don't know if it is still supported, but there was meant to be a
<nobr></nobr> tag. during the text you can use <wbr> as a
not-have-to-be-a-breaking row.
 
A

Alan J. Flavell

What on Earth was stopping you from looking at the HTML spec, and
finding the no-break space?
I don't know if it is still supported,
Herrschaftszeiten...

but there was meant to be a <nobr></nobr> tag.

Was there? Citation, please. In what way is this supposed to be an
improvement, for the questioner's purpose, on the defined semantics
for &nbsp; - or, for that matter, on the relevant CSS proposal (but
CSS proposals are optional, by design) ?

Just occasionally, you might find a proprietary extension which works
when it works, does not duplicate a function defined in the
interworking specifications, and does no real harm on client agents
which implement just the interworking specifications. But that
doesn't look like one of them.
during the text you can use <wbr> as a not-have-to-be-a-breaking
row.

Now that's *quite* a different matter. Previous discussion refers.
 
J

Jim Moe

Fons said:
I tried &nbsp before. Probably in a wrong way. Maybe the "span style" is
the best; is longer but, I think, gives the HTML a better readabillity.
Did you use "&nbsp" (incorrect) or "&nbsp;" (correct)?
The style option is better for long lines. It can also be made a ruleset
and applied wherever you want it.

.nobr { white-space: nowrap; }
<span class="nobr">abc def ghi</span>
<h3 class="nobr">abc def ghi</h3>
 
J

Jim Moe

Michael said:
I don't know if it is still supported, but there was meant to be a
<nobr></nobr> tag.
It was never part of the standard. <nobr> was added by Netscape and
later copied by IE. It is commonly supported by browsers but who knows how
long that will last?
 
F

Fons Rave

What on Earth was stopping you from looking at the HTML spec, and
finding the no-break space?

If that is the way people talk to eachother over here, this was the
first and last time of me putting a question in alt.html.

Well, let's just ignore; some people helped me.

Thanks to the other people,
Fons.
 
F

Fons Rave

Did you use "&nbsp" (incorrect) or "&nbsp;" (correct)?

I think the ";" is my problem. But: am I correct: e.g. "&nbsp-&nbsp" is
Ok. But e.g. "&nbspx&nbsp" is not ?
The style option is better for long lines. It can also be made a ruleset
and applied wherever you want it.

.nobr { white-space: nowrap; }
<span class="nobr">abc def ghi</span>
<h3 class="nobr">abc def ghi</h3>

That's more elegant.

Thanks,
Fons.
 
T

Toby Inkster

Fons said:
I think the ";" is my problem. But: am I correct: e.g. "&nbsp-&nbsp" is
Ok. But e.g. "&nbspx&nbsp" is not ?

Always include the semi-colon. Technically it's optional occasionally, but
browser support is iffy, and it's never wrong to include it.
 
N

Neredbojias

If that is the way people talk to eachother over here, this was the
first and last time of me putting a question in alt.html.

Sometimes you get resounding silence, too!
Well, let's just ignore; some people helped me.

Thanks to the other people,
Fons.

Why thank the people that _didn't_ help you? Wow, what a world...
 
T

Tony Watts

It was never part of the standard. <nobr> was added by Netscape and
later copied by IE. It is commonly supported by browsers but who knows how
long that will last?

Wouldn't the tag <pre></pre> allow the preservation of preformatted text's
spaces and line breaks? IS there any reason that would not be appropriate
here, other than potentially getting into lazy habits?

Tony Watts
 
L

Leonard Blaisdell

Wouldn't the tag <pre></pre> allow the preservation of preformatted text's
spaces and line breaks?
Yes.

IS there any reason that would not be appropriate
here, other than potentially getting into lazy habits?

The <pre> element does not preserve the semantics of the content it
encloses.

leo
 
J

Jukka K. Korpela

Tony Watts said:
Wouldn't the tag <pre></pre> allow the preservation of preformatted text's
spaces and line breaks?

It would. But that's not what was asked.
IS there any reason that would not be appropriate
here, other than potentially getting into lazy habits?

Yes. It's a block level element, implies monospace font, and preserves all
whitespace.

Regarding the original question, there are several possibilities, and the
best choice depends on the context, which was not disclosed. If you know how
to author in ISO 8859-1 (you should), you can simply use the no-break space
character (U+00A0), entered in some program-dependent way (e.g., Alt-160),
though then the problem is that you (or someone else reading your source)
cannot tell normal spaces from no-break spaces.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top