Turn header img into url whilst placing img with css???

Discussion in 'HTML & Website Design' started by Dogs_and_things, Aug 3, 2007.

  1. #1
    Hello,

    I placed my header-logo inside <div id="header"></div> using
    #header {
    width:100%;
    height:94px;
    background:url(images/cabecera.jpg) top center no-repeat;	
    }
    Code (markup):
    Now I would like to turn that header into a link back to my home page.

    I tried doing that with <a href="http://www.escuelacaninamaya.com/index.html"><div id="header"></div></a> and that works.

    But, it´s not valid html so here I am, stuck.:confused:

    Is there a way of doing this without having to do it by placing the image using html, can it be done using css to place the image and html to turn the header into a link?

    Greetings.
     
    Dogs_and_things, Aug 3, 2007 IP
  2. xd2

    xd2 Peon

    Messages:
    694
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <div id="header"><a href="/"><span style="width:100%; height:94px;"></span></a></div>
    - Might work but best way if you dont want to use your logo image would be to create a blank gif and lay it over your logo image and use that.
     
    xd2, Aug 3, 2007 IP
  3. runningthingz

    runningthingz Active Member

    Messages:
    396
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #3
    <div id="Masthead"><a href="index.html" title=""></a></div>

    Use the CSS Below in a stylesheet:

    #Masthead {
    position:relative;
    background:url("images/cabecera.jpg") no-repeat;
    height:94px;
    }

    /* index page link within #masthead */

    #Masthead a {
    position:absolute;
    left:48px;
    width:237px; /*Define the width of the link box*/
    top:59px;
    height:53px; /*Define the height of the link box*/
    }

    #Masthead a span {
    display:none; /*If the header image says anything add in a span tag for SEO but hide it.*/
    }
     
    runningthingz, Aug 3, 2007 IP
  4. xd2

    xd2 Peon

    Messages:
    694
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Just a quick reply but will the link tag work with nothing inside it?

    Wouldn't it need at least a:

    &nbsp; <- space
     
    xd2, Aug 3, 2007 IP
  5. Dogs_and_things

    Dogs_and_things Active Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #5
    Thanks,

    This works.

    But, now I have a problem with the css for normal links:
    a:hover,
    a:active {
    background-color:#FFF;
    }
    Code (markup):
    gives a white logo on hover.
     
    Dogs_and_things, Aug 3, 2007 IP
  6. HuggyCT2

    HuggyCT2 Guest

    Messages:
    222
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yes because you have stated a background color on the hover, if you place color:#FFFFFF; that will change the text color and not the background.
     
    HuggyCT2, Aug 3, 2007 IP
  7. Dogs_and_things

    Dogs_and_things Active Member

    Messages:
    97
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #7
    Where do I place this?
     
    Dogs_and_things, Aug 4, 2007 IP
  8. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I think he means in place of background-color:#F etc put color:#fffff That will make the text white. Or use different # if you didn't want white.
     
    Stomme poes, Aug 4, 2007 IP
  9. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Dan Schulz, Aug 4, 2007 IP