Formatting links

Discussion in 'HTML' started by John, Nov 22, 2005.

  1. John

    John Guest

    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
    John, Nov 22, 2005
    #1
    1. Advertising

  2. In article <%Zxgf.23110$q%>,
    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/>
    Leonard Blaisdell, Nov 22, 2005
    #2
    1. Advertising

  3. John

    Ed Jay Guest

    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)
    Ed Jay, Nov 22, 2005
    #3
  4. John

    David Guest

    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
    David, Nov 22, 2005
    #4
  5. In article <r1Agf.15249$>,
    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/>
    Leonard Blaisdell, Nov 22, 2005
    #5
  6. 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
    Jukka K. Korpela, Nov 22, 2005
    #6
  7. 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 |
    `-------------------------------------------------- --<--@ ------------'
    Barbara de Zoete, Nov 22, 2005
    #7
  8. John

    Sid Ismail Guest

    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
    Sid Ismail, Nov 22, 2005
    #8
  9. 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.
    Mitja Trampus, Nov 22, 2005
    #9
  10. John

    Neredbojias Guest

    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.
    Neredbojias, Nov 22, 2005
    #10
  11. In article <>,
    Neredbojias <> wrote:


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


    Now that's a fine solution to a nonexistent problem.

    > d) Don't use my name unless you send money.


    My two cents. In the bank for you.

    leo

    --
    <http://web0.greatbasin.net/~leo/>
    Leonard Blaisdell, Nov 22, 2005
    #11
  12. John

    David Guest

    Leonard Blaisdell wrote:

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

    >
    > 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
    David, Nov 22, 2005
    #12
  13. John

    David Guest

    Barbara de Zoete wrote:

    > 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
    David, Nov 22, 2005
    #13
  14. John

    David Guest

    David wrote:

    > ...


    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
    David, Nov 22, 2005
    #14
  15. John

    Neredbojias Guest

    With neither quill nor qualm, Leonard Blaisdell quothed:

    > In article <>,
    > Neredbojias <> wrote:
    >
    >
    > > <a href="welcome.html" style="display:block"><h2>Welcome</h2></a>

    >
    > Now that's a fine solution to a nonexistent problem.


    Is there a reward?

    > > d) Don't use my name unless you send money.

    >
    > My two cents. In the bank for you.


    Two cents?? Phffft! I'm going back to javascript...

    --
    Neredbojias
    Contrary to popular belief, it is believable.
    Neredbojias, Nov 23, 2005
    #15
  16. John

    David Guest

    Neredbojias wrote:
    > 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
    David, Nov 23, 2005
    #16
  17. David wrote:
    > Neredbojias wrote:
    >
    >> 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...


    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'



    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Nov 23, 2005
    #17
  18. John

    Neredbojias Guest

    With neither quill nor qualm, David quothed:

    > Neredbojias wrote:
    > > 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...


    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.

    --
    Neredbojias
    Contrary to popular belief, it is believable.
    Neredbojias, Nov 24, 2005
    #18
  19. John

    dorayme Guest

    > From: Neredbojias <>

    > With neither quill nor qualm, David quothed:
    >
    >> Neredbojias wrote:
    >>> 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...

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

    --
    dorayme
    dorayme, Nov 24, 2005
    #19
  20. John

    Toby Inkster Guest

    Neredbojias wrote:

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

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, Nov 24, 2005
    #20
    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. thaneesh

    Code formatting rules in editor

    thaneesh, Jul 2, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,148
    thaneesh
    Jul 2, 2003
  2. Lee Simpson

    Re: Formatting string in WHERE clause

    Lee Simpson, Jul 18, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,248
    Lee Simpson
    Jul 18, 2003
  3. www.westerncartooncards.ca

    Exchange Links < Western Cartoon Cards > Exchange Links

    www.westerncartooncards.ca, Jul 12, 2004, in forum: HTML
    Replies:
    2
    Views:
    1,217
    Toby Inkster
    Jul 12, 2004
  4. Mountaineer
    Replies:
    0
    Views:
    624
    Mountaineer
    May 14, 2011
  5. Garrett Smith
    Replies:
    14
    Views:
    295
    David Mark
    May 26, 2009
Loading...

Share This Page