How to avoid a space when doing a line break

Discussion in 'HTML' started by Stefan Mueller, Nov 13, 2005.

  1. I'd like to write my html code in a structured way.

    Therefore I don't like to write
    Please click here: (<a href = "next.html">link</a>)
    --> Output: Please click here: (link)

    I prefer
    Please click here: (
    <a href = "next.html">
    link
    </a>
    )
    --> Output: Please click here: ( link )

    Unfortunately in the second version I do have a space before and after the
    word 'link'.
    Does someone know if there's a tag or something like that to tell the
    browser not to add a space?

    Stefan

    PS: This is only a simplified example which shows my problem. My real 'a
    href' has many lines like onMouseover, onMouseout, ...
     
    Stefan Mueller, Nov 13, 2005
    #1
    1. Advertising

  2. "Stefan Mueller" <> wrote:

    > I'd like to write my html code in a structured way.


    Fine.

    >
    > Therefore I don't like to write
    > Please click here: (<a href = "next.html">link</a>)
    > --> Output: Please click here: (link)


    "Output"? HTML is not a programming language.

    Anyway, it's indeed bad practice. "Please click here" is foolish for many
    reasons, though less foolish outside link text than inside it. Consider what
    it looks like on paper, or in a browsing environment without anything to
    click with. It also distracts from the context.

    > I prefer
    > Please click here: (
    > <a href = "next.html">
    > link
    > </a>
    > )
    > --> Output: Please click here: ( link )


    Why would that be better?

    It seems that by "structured" you mean "prettyprinted". In that case, the
    rules of HTML constitute a limitation. Spaces are significant as separators.

    > Does someone know if there's a tag or something like that to tell the
    > browser not to add a space?


    You are kidding, aren't you?

    > PS: This is only a simplified example which shows my problem. My real 'a
    > href' has many lines like onMouseover, onMouseout, ...


    It's not simple enough. And the onmouseover stuff most probably causes just
    annoyance and distractions. But this does not affect the basic problem.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Nov 13, 2005
    #2
    1. Advertising

  3. Stefan,

    Remember that you can insert line breaks within tags. For example, this
    will work:

    <a href="..."
    onMouseOver="..."
    onMouseOut="..."
    >Text</a>


    Doing it that way makes it more readable while avoiding the troublesome
    space that line breaks can cause in A tags.

    Cheers,
    Matt
    www.editme.com
     
    Matt - EditMe.com, Nov 13, 2005
    #3
  4. > Remember that you can insert line breaks within tags. For example, this
    > will work:
    >
    > <a href="..."
    > onMouseOver="..."
    > onMouseOut="..."
    >>Text</a>

    >


    Yea, I know that. But it seams that I can't insert line breaks outside tags
    :-(
    Therefore I guess I'll use
    Please click here:
    (<a href = "next.html"
    >link</a>)


    Thanks
    Stefan
     
    Stefan Mueller, Nov 13, 2005
    #4
  5. On Mon, 14 Nov 2005, Stefan Mueller wrote:

    > Therefore I guess I'll use
    > Please click here:


    Oh dear, an outbreak of the dreaded "click here" disease.
     
    Alan J. Flavell, Nov 13, 2005
    #5
  6. Stefan Mueller

    Neredbojias Guest

    With neither quill nor qualm, Stefan Mueller quothed:

    > I'd like to write my html code in a structured way.
    >
    > Therefore I don't like to write
    > Please click here: (<a href = "next.html">link</a>)
    > --> Output: Please click here: (link)
    >
    > I prefer
    > Please click here: (
    > <a href = "next.html">
    > link
    > </a>
    > )
    > --> Output: Please click here: ( link )


    Proper structuring automatically accounts for whitespace.

    > Unfortunately in the second version I do have a space before and after the
    > word 'link'.
    > Does someone know if there's a tag or something like that to tell the
    > browser not to add a space?


    There isn't, although perhaps the w3c will develop one in the coming
    years to replace another useful tag.

    > Stefan
    >
    > PS: This is only a simplified example which shows my problem. My real 'a
    > href' has many lines like onMouseover, onMouseout, ...
    >
    >
    >


    --
    Neredbojias
    Contrary to popular belief, it is believable.
     
    Neredbojias, Nov 13, 2005
    #6
  7. > Oh dear, an outbreak of the dreaded "click here" disease.

    Like I mentioned in my original post. It's just an example. I'm not using it
    in this context.
    Sorry that I used it in this example.

    Stefan
     
    Stefan Mueller, Nov 14, 2005
    #7
  8. Stefan Mueller

    dorayme Guest

    > From: "Jukka K. Korpela" <>
    >
    > "Stefan Mueller" <> wrote:
    >
    >>
    >> Therefore I don't like to write
    >> Please click here: (<a href = "next.html">link</a>)
    >> --> Output: Please click here: (link)

    >
    > "Output"? HTML is not a programming language.
    >


    OP just means that you put stuff in the html source page and the
    browser displays it thus. The image is perhaps of a sausage
    machine: put something in one bit and get something else out of
    another bit. Input and output. If anyone - anyone at all on
    alt.html - finds this helpful, please send me a nice postcard.

    --
    dorayme
     
    dorayme, Nov 14, 2005
    #8
  9. Stefan Mueller

    Chaddy2222 Guest

    Stefan Mueller wrote:

    > I'd like to write my html code in a structured way.
    >
    > Therefore I don't like to write
    > Please click here: (<a href = "next.html">link</a>)
    > --> Output: Please click here: (link)
    >
    > I prefer
    > Please click here: (
    > <a href = "next.html">
    > link
    > </a>
    > )
    > --> Output: Please click here: ( link )


    You could just right your links as follows:
    <a
    href="examplepage.html">ExampleLink</a>
    Quite simple really.
    --

    Regards Chad. http://freewebdesign.cjb.cc

    >
    > Unfortunately in the second version I do have a space before and after the
    > word 'link'.
    > Does someone know if there's a tag or something like that to tell the
    > browser not to add a space?
    >
    > Stefan
    >
    > PS: This is only a simplified example which shows my problem. My real 'a
    > href' has many lines like onMouseover, onMouseout, ...
     
    Chaddy2222, Nov 14, 2005
    #9
    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. Shuo Xiang

    Stack space, global space, heap space

    Shuo Xiang, Jul 9, 2003, in forum: C Programming
    Replies:
    10
    Views:
    2,956
    Bryan Bullard
    Jul 11, 2003
  2. Christian Seberino
    Replies:
    21
    Views:
    1,769
    Stephen Horne
    Oct 27, 2003
  3. Ian Bicking
    Replies:
    2
    Views:
    1,082
    Steve Lamb
    Oct 23, 2003
  4. Ian Bicking
    Replies:
    2
    Views:
    765
    Michael Hudson
    Oct 24, 2003
  5. kundan kumar
    Replies:
    4
    Views:
    1,316
    Kevin Spencer
    Oct 1, 2006
Loading...

Share This Page