Announcement

Collapse
No announcement yet.

Linking to a certain section of another page...bug?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Linking to a certain section of another page...bug?

    I know how this is accomplished...

    <a href="http://blah.com/page2.html#section2"><a>

    on page2.html...

    <h2 id="section2"></h2>

    It works fine when I put the id on a header element, but if I try to put it on a div it doesn't work. Is this normal? I noticed it works in IE7, but not Firefox or Safari.

  • #2
    You should be targeting a named anchor, not an id:

    <a href="http://blah.com/page2.html#section2"><a>

    on page2.html...

    <a name="section2"><a><h2 id="section2"></h2>


    Digi
    The world is divided into people who think they are right.
    —Anonymous

    Comment


    • #3
      Originally posted by digizan View Post
      You should be targeting a named anchor, not an id:

      <a href="http://blah.com/page2.html#section2"><a>

      on page2.html...

      <a name="section2"><a><h2 id="section2"></h2>


      Digi

      seems a little weird to put a blank anchor tag doesn't it?

      Comment


      • #4
        Originally posted by MikeTheVike View Post
        seems a little weird to put a blank anchor tag doesn't it?
        Not to me it doesn't. ;-)

        You could wrap your anchor around the text of your heading:

        <h2 id="section2"><a name="section2">Foo<a></h2>

        But then you're probably going to have to add more CSS to stop the heading from looking like a link.

        Digi
        The world is divided into people who think they are right.
        —Anonymous

        Comment


        • #5
          Okay, I've been up all night finishing a web site and my brain is toast right now.

          This should work:

          <h2 id="section2" name="section2">Foo</h2>

          Digi
          The world is divided into people who think they are right.
          —Anonymous

          Comment


          • #6
            Originally posted by digizan View Post
            Okay, I've been up all night finishing a web site and my brain is toast right now.

            This should work:

            <h2 id="section2" name="section2">Foo</h2>

            Digi

            yea, it actually works with just the "id", the "name" isn't necessary. I was just wondering why it wasn't working on a div because it would make my heading a little more visible if the page jumped to the top of my div instead of the heading.

            Comment


            • #7
              Originally posted by MikeTheVike View Post
              yea, it actually works with just the "id", the "name" isn't necessary. I was just wondering why it wasn't working on a div because it would make my heading a little more visible if the page jumped to the top of my div instead of the heading.
              Yeah, now that I've gotten a couple of hours of sleep it's clear what you were asking. I should know better than to post on the forums when I'm dead tired like that.

              Anyway, I created a test page and have no problem jumping to a div using an id in either FF or Safari. Maybe you're overlooking something?

              Digi
              The world is divided into people who think they are right.
              —Anonymous

              Comment

              Search

              Collapse

              Advertisement

              Collapse

              Latest Topics

              Collapse

              • Protagonist
                Reply to Logo Animation Help
                Protagonist
                designzombie eerrr wrong. You can do this quickly two ways. You can use an effect called "paint on" and literally paint a brush stroke over the script (say 5 frames per stroke). From there you...
                Today, 01:42 AM
              • Protagonist
                Reply to First stabs at a personal logo
                Protagonist
                Not bad, I would prefer your counters be in the shape of the original font and not perfect circles.
                Today, 01:24 AM
              • Protagonist
                Reply to Website Critique?
                Protagonist
                The design isn't bad in my opinion although there is still a lot that you need to do in terms of coding and backend - all of which I know nothing about. But as far as design it's not bad. The background...
                Yesterday, 11:32 PM
              • Protagonist
                Reply to Motion Graphics Dissertation Advice
                Protagonist
                There isn't much out there because the industry is so new (digital, celluloid has been around for about 100 years). I'm a Motionographer and the industry is really a cross between Filmmakers, Graphic...
                Yesterday, 11:28 PM
              • Northeast Ink
                Comment on Show customer Pantones used in design
                Northeast Ink
                OK I've concluded that the best way to do it is how I'm doing it already. Manually entering in. I have PDF software that I thought might be able to generate it and seeing that there are some Scripts...
                Yesterday, 10:16 PM

              20% Off Sale at iStock until Sept 30, 2016
              GDF A division of Mediabistro Holdings Adweek | Mediabistro | Clio | Film Expo Group Contact Us | Terms of Use | Privacy Policy Copyright © 2016 Mediabistro Holdings
              Working...
              X