Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Formatting links

Reply
Thread Tools

Formatting links

 
 
John
Guest
Posts: n/a
 
      11-22-2005
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
 
Reply With Quote
 
 
 
 
Leonard Blaisdell
Guest
Posts: n/a
 
      11-22-2005
In article <%Zxgf.23110$q%(E-Mail Removed)> ,
John <anonymous@anonymous_one.com> wrote:

> 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

--
<http://web0.greatbasin.net/~leo/>
 
Reply With Quote
 
 
 
 
Ed Jay
Guest
Posts: n/a
 
      11-22-2005
John <anonymous@anonymous_one.com> wrote:

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

--
Ed Jay (remove M to respond by email)
 
Reply With Quote
 
David
Guest
Posts: n/a
 
      11-22-2005
Leonard Blaisdell wrote:

> 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
 
Reply With Quote
 
Leonard Blaisdell
Guest
Posts: n/a
 
      11-22-2005
In article <r1Agf.15249$(E-Mail Removed) >,
David <anonymous@anonymous_one.com> wrote:

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

--
<http://web0.greatbasin.net/~leo/>
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      11-22-2005
David <anonymous@anonymous_one.com> wrote:

> Leonard Blaisdell wrote:
>
>> 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.


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

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


 
Reply With Quote
 
Barbara de Zoete
Guest
Posts: n/a
 
      11-22-2005
On Tue, 22 Nov 2005 08:46:31 +0100, David <anonymous@anonymous_one.com>
wrote:

> Leonard Blaisdell wrote:
>
>> 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.


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 |
`-------------------------------------------------- --<--@ ------------'
 
Reply With Quote
 
Sid Ismail
Guest
Posts: n/a
 
      11-22-2005
On Tue, 22 Nov 2005 07:46:31 GMT, David <anonymous@anonymous_one.com>
wrote:

: 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


 
Reply With Quote
 
Mitja Trampus
Guest
Posts: n/a
 
      11-22-2005
David wrote:
> Leonard Blaisdell wrote:
>
>> 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.
>
> 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.
 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      11-22-2005
With neither quill nor qualm, David quothed:

> Leonard Blaisdell wrote:
>
> > 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?


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.

--
Neredbojias
Contrary to popular belief, it is believable.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Amazon Kindle formatting - helpful links and advice Mountaineer HTML 0 05-14-2011 09:19 PM
Make A Shorter Link - no new links accepted, old links still work. why? Computer Support 7 01-02-2007 09:45 PM
Site Links and Physical WAN Links =?Utf-8?B?RW5mb1BhdWw=?= MCSE 2 03-22-2005 09:23 AM
Exchange Links < Western Cartoon Cards > Exchange Links www.westerncartooncards.ca HTML 2 07-12-2004 07:59 PM
Need formatting options menu for formatting hard drive Mark T. Computer Support 3 11-24-2003 11:50 PM



Advertisments