Search code examples
htmlcsshrefcss-shapes

Is it possible to make a href with bigger bottom padding for an arrow


I want to make top menu with arrow image on hover, that will display on border line of the next div.

My fast made fiddle:

and an image of what I want to do

HTML

<div class="wrapper">
    <img src="" alt="" id="logo" />
    <ul id="topmenu">
        <li><a href="" title="">item 1</a></li>
        <li><a href="" title="">item 2</a></li>
        <li><a href="" title="">item 3</a></li>
    </ul>
</div>

<div class="full-width-page">
    <div class="wrapper">
        <div id="header-image">
            image with content goes here
        </div>
    </div>
</div>

CSS

.wrapper {
    width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.full-width-page {
    width: 100%;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    overflow: hidden;
}

#logo {
    float: left;
    width: 200px;
    height: 30px;
    background-color: gray;
    margin-top: 15px;
}

#topmenu {
    float: right;
    display: block;
    list-style: none;
    margin: 0px;
    padding: 20px;
}

#topmenu li {
    display: inline-block;
    padding-bottom: 20px;
}

#topmenu li a:hover {
    background-image: url(http://www.ristatebassmasters.com/images/smallDownArrow.gif);
    background-repeat: no-repeat;
    background-position: center 8px;
}

#header-image {
    height: 200px;
    line-height: 200px;
}

I know that there is a solution to create the menu to be position: absolute. And then making padding-bottom on href will push the arrow down further, but when the menu will be positioned absolute I will not be able to push it using float: right.


Solution

  • Here's an updated fiddle of what you want.

    CSS

    #topmenu {
        display: block;
        list-style: none;
        margin: 0px;
        padding: 20px;
        position: absolute;
        right: 0;
        top: 0;
    }
    #topmenu li {
        display: inline-block;
        padding-bottom: 20px;
    }
    
    #topmenu li a{
        padding-bottom: 30px; 
    }
    #topmenu li a:hover {
        background-image: url(http://www.ristatebassmasters.com/images/smallDownArrow.gif);
        background-repeat: no-repeat;
        background-position: center 32px;
    
    }
    #header-image {
        height: 200px;
        line-height: 200px;
    }