Formatting links

J

John

I'm trying to format a link to look like an H2 header (with a link
underline), like the following:

<a href="welcome.html"><h2>Welcome</h2></a>

That works in IE and FF, but Tidy complains: missing </a> before <h2>. I
tried playing with the class location, like "<a class = "h2"
href="welcome.html">Welcome</a>", and other methods, but I can't get that
to work right. Any ideas, or should I just leave the warning in?

Thanks,
David
 
L

Leonard Blaisdell

John said:
I'm trying to format a link to look like an H2 header (with a link
underline), like the following:

<a href="welcome.html"><h2>Welcome</h2></a>
Any ideas, or should I just leave the warning in?

You can't put a block element <h2> inside an inline element <a>. Do
<h2><a href="welcome.html">Welcome</a></h2> which puts the inline inside
the block.

leo
 
E

Ed Jay

John said:
I'm trying to format a link to look like an H2 header (with a link
underline), like the following:

<a href="welcome.html"><h2>Welcome</h2></a>

That works in IE and FF, but Tidy complains: missing </a> before <h2>. I
tried playing with the class location, like "<a class = "h2"
href="welcome.html">Welcome</a>", and other methods, but I can't get that
to work right. Any ideas, or should I just leave the warning in?
Any reason why you can't do <H2><a href...>Welcome</a></H2>?
 
D

David

Leonard said:
You can't put a block element <h2> inside an inline element <a>. Do
<h2><a href="welcome.html">Welcome</a></h2> which puts the inline inside
the block.

But doing that doesn't result in the output I want in either IE or FF. It
outputs the 'Welcome' in small letters, compared to the big letters of
regular h2 format. The code I posted displays as I want, it just gives a
warning, though, and I thought I'd try to resolve that.

(You can try it yourself and see the difference I'm talking about.)

Maybe the only way to resolve it is to create a new link class with the
characteristics of the h2 class, but that is disappointing, to say the
least. I was hoping for something a little more elegant to give a link the
characteristics of another class, except underlined and such. But maybe
the 'underlined and such' makes it so a new link class is the only way. Is
it only (mis)fortunate that my hack works?

Thanks, (you too, Ed)
David
 
L

Leonard Blaisdell

David said:
(You can try it yourself and see the difference I'm talking about.)

Well, I can't. I don't believe you gave a URL. Your main problem was
obvious which was block inside inline. And you posted with a different
name which was John before. URL please.
Good grief, don't be so paranoid as to post with a different name every
time.

leo
 
J

Jukka K. Korpela

David said:
But doing that doesn't result in the output I want in either IE or FF.

You haven't told us anything about your style sheet. You apparently have some
style sheet since otherwise you would have written thusly:
It outputs the 'Welcome' in small letters, compared to the big letters of
regular h2 format.

Naturally, styling depends on markup.
The code I posted displays as I want, it just gives a
warning, though, and I thought I'd try to resolve that.

It is not a warning. What you get from Tidy is the same you would get from a
validator: a report about a syntax error, meaning that your document does not
comply with HTML specifications, and isn't strictly speaking an HTML document
at all; hence there is no specification on what a browser should do with it.
(You can try it yourself and see the difference I'm talking about.)

Why don't you tell the URL to help people who might help you for free?
Maybe the only way to resolve it is to create a new link class with the
characteristics of the h2 class, but that is disappointing, to say the
least. I was hoping for something a little more elegant to give a link
the characteristics of another class, except underlined and such. But
maybe the 'underlined and such' makes it so a new link class is the only
way. Is it only (mis)fortunate that my hack works?

It sounds that you are thoroughly confused. There is no "h2 class", to begin
with.

Is "Welcome" a second-level heading on the page? If not, simply don't use h2
markup for it. If you style it, do _not_ try to make it appear in the style
you expect browsers to use for second-level headings, because that would
confuse users. Start from something simple like

<div class="greeting"><a href="...">Welcome</a></div>

though it's highly questionable whether a greeting should be a link (and
whether you should waste space and user's time with "Welcome" texts, which
are a common signal of naive design and lack of useful content - on the Web,
courtesy means getting to the point without babbling).
 
B

Barbara de Zoete

But doing that doesn't result in the output I want in either IE or FF.
It outputs the 'Welcome' in small letters, compared to the big letters
of regular h2 format.

There shouldn't be a difference in appearance between <h2>Welcome</h2> and
<h2><a>Welcome</a></h2>. If there is, you probably have created the
difference yourself by setting some font-size value for <a></a>.

Besides that, it doesn't matter what it looks like. Looks are something
you take care of outside the markup, with css. Setup a style for the
selector [ h2 a ].



--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
S

Sid Ismail

: Maybe the only way to resolve it is to create a new link class with the
: characteristics of the h2 class, but that is disappointing, to say the
: least.


Why disappointing?

Sid
 
M

Mitja Trampus

David said:
But doing that doesn't result in the output I want in either IE or FF.
It outputs the 'Welcome' in small letters, compared to the big letters
of regular h2 format.

Maybe the only way to resolve it is to create a new link class with the
characteristics of the h2 class,

I haven't tried that, but I suppose setting font-size,
font-family and font-weight to "inherit" for all "a"
elements should do what you want. Just take care that you do
not make the links too much like the surrounding text, or
they will be hard to spot.
 
N

Neredbojias

With neither quill nor qualm, David quothed:
But doing that doesn't result in the output I want in either IE or FF. It
outputs the 'Welcome' in small letters, compared to the big letters of
regular h2 format. The code I posted displays as I want, it just gives a
warning, though, and I thought I'd try to resolve that.

(You can try it yourself and see the difference I'm talking about.)

Maybe the only way to resolve it is to create a new link class with the
characteristics of the h2 class, but that is disappointing, to say the
least. I was hoping for something a little more elegant to give a link the
characteristics of another class, except underlined and such. But maybe
the 'underlined and such' makes it so a new link class is the only way. Is
it only (mis)fortunate that my hack works?

You could try this:

<a href="welcome.html" style="display:block"><h2>Welcome</h2></a>

Of course:

a) I haven't tried it myself.
b) You may still get the error msg.
c) It may not work anyway.
d) Don't use my name unless you send money.
 
D

David

Leonard said:
Well, I can't.

It is simple to put together a test in an editor, so technically, it should
be 'I won't' :)
I don't believe you gave a URL.

Just for you, and everyone else:
http://www.randommonkeyworks.com/work/TEST.html
Good grief, don't be so paranoid as to post with a different name every
time.

Sorry. I hadn't used this account in a long time, and forgot how I had it
set up. When I realized my mistake (immediately after posting the original
post), I fixed the account.

Thanks for the help.

David
 
D

David

Barbara said:
There shouldn't be a difference in appearance between <h2>Welcome</h2>
and <h2><a>Welcome</a></h2>. If there is, you probably have created
the difference yourself by setting some font-size value for <a></a>.

Ah! You've got it! Thanks.
Besides that, it doesn't matter what it looks like. Looks are something
you take care of outside the markup, with css. Setup a style for the
selector [ h2 a ].

Will do.

Thanks,
David
 
D

David

David said:

Barbara had it and it didn't immediately register until after I posted the
reply to you. Thanks for trying to help me, along with everyone else who
posted.

David
 
D

David

Neredbojias said:
With neither quill nor qualm, Leonard Blaisdell quothed:

Where did the term 'quill nor qualm' originate from? It seems to literally
indicate 'Without using a pen or being nauseated...', and that, in a way,
does not make sense, but I recall coming across the phrase before...

David
 
J

Jonathan N. Little

David said:
Where did the term 'quill nor qualm' originate from? It seems to
literally indicate 'Without using a pen or being nauseated...', and
that, in a way, does not make sense, but I recall coming across the
phrase before...

I don't think he meant the 'ill feeling like queasy' version of the word
but the variant 'An uneasy feeling about the propriety or rightness of a
course of action.' as use in the fairly common expression: 'Now qualms
about it'
 
N

Neredbojias

With neither quill nor qualm, David quothed:
Where did the term 'quill nor qualm' originate from? It seems to literally
indicate 'Without using a pen or being nauseated...', and that, in a way,
does not make sense, but I recall coming across the phrase before...

I made it up (-not saying it wasn't made-up before, but I never saw it
if so.) As Jonathan suggested, the "qualm" means a feeling of doubt or
misgivings about something.
 
D

dorayme

From: Neredbojias said:
With neither quill nor qualm, David quothed:


I made it up (-not saying it wasn't made-up before, but I never saw it
if so.) As Jonathan suggested, the "qualm" means a feeling of doubt or
misgivings about something.


No, no. A qualm is an astringent, highly intoxicating drink.
Occasionally, people do not have any in order to appear sharper
than usual when addressing bods at alt.html.
 
T

Toby Inkster

Neredbojias said:
<a href="welcome.html" style="display:block"><h2>Welcome</h2></a>

A is still inline, so can't contain an H2 element. (Just because you've
made it *look* like it's a block element, doesn't mean it really *is* a
block element!)

If you want a valid way of nesting an H2 element within an A element, both
of these will validate:

<a><object><h2>Hello</h2></object></a>

<a><noscript><h2>World</h2></noscript></a>

Though neither is likely to do what the OP wants.
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top