WordPress.org

Forums

Making Header Linkable (6 posts)

  1. dirtyscarab
    Member
    Posted 7 years ago #

    I've read how to make headers linkable, but the trouble is, my header is part of my background image.

    is there any way to make the 'image/flowers.jpg' shown below linkable??

    My site: Link

    My code inside the style.css:

    #header{
    background:url(images/flowers.jpg) left no-repeat #FFF;
    }

    #header .inside{
    padding: 7em 0px;
    }

    #header h2{
    border-right: 1px solid #808080;
    float: left;
    font-size: 2.25em;
    margin: 0px 0.5em 0px 0px;
    padding: 0px 0.5em 0.25em 0px;
    }

    #header h2 a{
    color: #000000;
    text-decoration: none;
    }

    #header p{
    line-height: 1em;
    margin: 0px;
    padding: 1em 0px;
    }

  2. Adam Brown
    Member
    Posted 7 years ago #

    The easiest way is to take the image out of the CSS and put it into an <img ... /> tag surrounded by <a> tags.

  3. moshu
    Member
    Posted 7 years ago #

    Another option... and you should have found this because it is from here, from the forum:
    <div id="header" onclick="location.href='http://example.com/';" style="cursor: pointer;">
    This should be done in the header.php file.

  4. Adam Brown
    Member
    Posted 7 years ago #

    I guess I mispoke; moshu's solution is the easiest. But if you have any blog visitors with non-javascript browsers (mainly blind folks), though, take the non-javascript route.

  5. A non-javascript way to do it is to put the link inside your header DIV, and then use CSS to give the link absolute position and size (same size as the header DIV).

    The general technique is like this:

    <div id="header">
    <a href="http://example.com/"></a>
    </div>
    ...
    #header a { position:absolute;
    	left:0px; top:0px; width:600px;	height:150px; }

    Or whatever works for your positioning.

    Also, I'd make that header image centered if I were you. Looks way better centered instead of shoved over to the left.

  6. dirtyscarab
    Member
    Posted 7 years ago #

    Brilliant. Thanks Guys.

Topic Closed

This topic has been closed to new replies.

About this Topic