Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] CSS Logo HREF LINK

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #187158
    intodesign
    Participant

    Hey,

    I’ve notice when I’m creating a website and trying to link the logo to the homepage,
    The href I get is for the whole div and i want it to be only on the image,

    example:
    http://codepen.io/anon/pen/qipgG

    #187159
    Paulie_D
    Member

    You can’t ‘link’ a background image.

    This is your structure

    
      <a href="#">
        <div class="logo"></div>
      </a>
    

    The only thing in the link IS the div so naturally, the div links.

    You could do this

    
        <div class="logo">
          <a href="#"> </a>
        </div>
    

    and use the image as a background of the link but you would have to define a size for the link in your CSS

    OR…you could do this

    
        <div class="logo">
          <a href="#">
            <img src="whatever" alt="" />
          </a>
        </div>
    

    and put the actual image in the HTML.

    It’s up to you….any variety of the above including just

    
          <a href="#" class="logo">
            <img src="whatever" alt="" />
          </a>
    

    works too.

    #187161
    intodesign
    Participant

    I tried the img src method before and it was with the same problem,
    but i guess i did something wrong, now it’s working

    Thanks anyway

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.