How to avoid a space when doing a line break

S

Stefan Mueller

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

Jukka K. Korpela

Stefan Mueller said:
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.
 
M

Matt - EditMe.com

Stefan,

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

<a href="..."
onMouseOver="..."
onMouseOut="..."

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
 
S

Stefan Mueller

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

<a href="..."
onMouseOver="..."
onMouseOut="..."

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
 
N

Neredbojias

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

Stefan Mueller

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
 
D

dorayme

From: "Jukka K. Korpela said:
"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.
 
C

Chaddy2222

Stefan said:
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.
 

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
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top