如何将我的社交按钮与导航的其余部分对齐?

时间:2013-01-05 04:17:46

标签: html css alignment

我一直试图将我的社交按钮(facebook // twitter)与我的其余标题和&导航。我把头撞在墙上,似乎无法找到解决方案让一切都排好。希望一些新鲜的眼睛可以帮助。我在这里创建了一个当前代码的jsFiddle:http://jsfiddle.net/yZ4sm/我无法排列的社交按钮是右边两个破碎的图像(在jsFiddle中)。

我希望最终结果看起来像this

请参阅我的HTML&下面的CSS:

HTML

<div id="headerWrapper">

    <div id="headerContent">

        <div id="grappleAnchor">
            <a href="index.html"> <img id="grappleAnchorLogo" src="img/grapple-logo.png" alt=" "> </a>
        </div>


        <div id="navigation">
            <div class="navigationLink">
                <a class="activeLink" href="index.html">Home</a>
                <div id="navigationMarker">
                </div>
            </div>        
            <div class="navigationLink">
                <a href="services.html">Services</a>
            </div>
            <div class="navigationLink">
                <a href="#">About</a>
            </div>
            <div class="navigationLink">
                <a href="#">Blog</a>
            </div>
            <div class="navigationLink">
                <a href="#">Contact</a>
            </div>
        </div>

        <div id="social">

            <div id="facebook">
                <a href="http://www.facebook.com/GrappleConsulting" target="_blank"> <img class="greydout" src="icons/facebook.png" alt=" "> </a>
            </div>

            <div id="twitter">
                <a href="http://twitter.com/blair_gorrell" target="_blank"> <img class="greydout" src="icons/twitter_bird.png" alt=" "> </a>
            </div>
        </div>

    </div>​

CSS

#headerWrapper {
    background-color: #e6e4e4;
    height:5em;
}

#headerContent {
    height:80px;

    margin: 0 auto; /*top, right, bottom, left*/
    padding: 0px 0; /*top&bottom, left&right */
    width: 955px;
}


/*---------->Logo Start<----------*/

    #grappleAnchor {

        clear:none;
        float:left;
        margin: 0;
        padding: 0;
    }

    #grappleAnchor a {
        display: block;
        float:left;
        text-decoration: none;
    }

    #grappleAnchorLogo {
        height: 70px;
    }

    #grappleAnchor a img {
        border: none;
    }

/*---------->Logo End<----------*/


/*---------->Navigation Start<----------*/

#navigation {
    line-height: 5em;
}

#navigation a:hover, #navigation a:active, #navigation a.activeLink {
    color: #FFF;
}

#navigation a {
    color:#000;
    margin: 0 1em 0 1em; /*top, right, bottom, left*/
    text-decoration: none;
}

div.navigationLink {
    float:left;
    font-size: 1.4em;
}

#navigationMarker{
    border-bottom: #FFF solid 0.8em;
    border-top: none;
    border-left: transparent solid 0.8em;
    border-right: transparent solid 0.8em;
    height: 0;
    margin-top: -0.7em;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    width: 1px;    
}

/*---------->Navigation End<----------*/


/*---------->Social Start<----------*/

#social {
    float:left;
    font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue",    Helvetica, Arial, "Lucida Grande", sans-serif; 

}

#facebook, #twitter{
    background-color: #fff;
    border-radius: 20px;
    display: block;
    float: left;
    height: 32px;
    margin: 0 .5em 0 .5em; /*top, right, bottom, left*/
    -webkit-border-radius: 20px;
    width: 32px;    
}

.greydout{
    -moz-opacity: 0.25;
    opacity: 0.25;
    -webkit-opacity: 0.25;
}

.greydout:hover {
  -moz-opacity: 1;
  opacity: 1;
  -webkit-opacity: 1;
}

1 个答案:

答案 0 :(得分:0)

尝试使用保证金:

#social {
  float:left;
  margin-top: 1.5em;
  font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;    
}