Keeping words together

Discussion in 'HTML' started by Fons Rave, May 9, 2006.

  1. Fons Rave

    Fons Rave Guest

    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.
    Fons Rave, May 9, 2006
    #1
    1. Advertising

  2. Fons Rave

    ironcorona Guest

    Fons Rave wrote:
    > 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

    --
    Brian O'Connor (ironcorona)
    ironcorona, May 9, 2006
    #2
    1. Advertising

  3. Fons Rave

    Mimic Guest

    Fons Rave wrote:
    > 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."
    Mimic, May 9, 2006
    #3
  4. Fons Rave

    Jim Moe Guest

    Fons Rave wrote:
    > 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>.

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
    Jim Moe, May 9, 2006
    #4
  5. Fons Rave

    Fons Rave Guest

    All thanks for the help.

    >>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>.


    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.
    Fons Rave, May 9, 2006
    #5
  6. Fons Rave schrieb:
    > 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.
    Michael Hedinger, May 9, 2006
    #6
  7. On Tue, 9 May 2006, Michael Hedinger wrote:

    > Fons Rave schrieb:
    > > 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.


    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.
    Alan J. Flavell, May 9, 2006
    #7
  8. Fons Rave

    Jim Moe Guest

    Fons Rave wrote:
    >>
    >> 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.
    >

    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>

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
    Jim Moe, May 9, 2006
    #8
  9. Fons Rave

    Jim Moe Guest

    Michael Hedinger wrote:
    >
    > 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?

    --
    jmm (hyphen) list (at) sohnen-moe (dot) com
    (Remove .AXSPAMGN for email)
    Jim Moe, May 9, 2006
    #9
  10. Fons Rave

    Fons Rave Guest


    > 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.
    Fons Rave, May 9, 2006
    #10
  11. Fons Rave

    Fons Rave Guest


    > 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.
    Fons Rave, May 9, 2006
    #11
  12. Fons Rave

    Toby Inkster Guest

    Fons Rave wrote:

    > 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.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, May 9, 2006
    #12
  13. Fons Rave

    Neredbojias Guest

    To further the education of mankind, Fons Rave <fonzzz-at-xs4all-dot-nl>
    vouchsafed:

    >
    >> 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.


    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...

    --
    Neredbojias
    Infinity has its limits.
    Neredbojias, May 10, 2006
    #13
  14. Fons Rave

    Tony Watts Guest


    > Michael Hedinger wrote:
    >>
    >> 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?
    >


    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
    Tony Watts, May 10, 2006
    #14
  15. In article <>,
    "Tony Watts" <> wrote:


    > 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

    --
    <http://web0.greatbasin.net/~leo/>
    Leonard Blaisdell, May 10, 2006
    #15
  16. "Tony Watts" <> wrote:

    > 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.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, May 10, 2006
    #16
  17. Fons Rave

    Fons Rave Guest


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


    People that helped and people not being obnoxious.

    Fons.
    Fons Rave, May 10, 2006
    #17
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Strøiman
    Replies:
    1
    Views:
    2,070
    Peter Strøiman
    Aug 23, 2005
  2. Nik Coughin
    Replies:
    2
    Views:
    587
    Jeff Thies
    Jul 28, 2004
  3. John Butler
    Replies:
    2
    Views:
    153
    Colin Bartlett
    Jun 3, 2010
  4. Replies:
    1
    Views:
    148
    Steven D'Aprano
    Nov 20, 2012
  5. Tim Chase
    Replies:
    0
    Views:
    156
    Tim Chase
    Nov 20, 2012
Loading...

Share This Page