4

I'm trying to get my footer text vertically aligned within my footer DIV but that does not work. I tried vertical-align: middle without success. What is the issue? Many thanks JSfiddle: http://jsfiddle.net/Grek/hqdP2/

<div class="menu">
      <div class="inner"> <a href="www.dfdsfdsfs.com/index.html" class="logo">Gregory</a>
    <ul>
          <li > <a href="www.dfdsfdsfs.com">Category 1</a> </li>
          <li > <a href="www.dfdsfdsfs.com">Category 2</a> </li>
          <li > <a href="www.dfdsfdsfs.com">Category 3</a> </li>
          <li > <a href="www.dfdsfdsfs.com">Category 4</a> </li>
          <li > <a href="www.dfdsfdsfs.com">Category 5</a> </li>
          <li class="selected"> <a href="www.dfdsfdsfs.com/">Category 6</a> </li>
          <li > <a href="www.dfdsfdsfs.com">Contact</a> <span class="pipe"></span> </li>
        </ul>
    <div class="social">
          <div class="fb-like" data-href="http://www.123.com" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>
        </div>
  </div>
    </div>
<div id="quote">
      <blockquote>
    <p>"Nos soutenons depuis la début"</p>
    <cite>Innovation</cite> </blockquote>
      <blockquote>
    <p>"L'exceptionnelle"</p>
    <cite>Hydro-geologiste</cite> </blockquote>
    </div>

<div class="article content">
      <h1>Biography</h1>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    <a class="image-popup-vertical-fit" href="http://farm9.staticflickr.com/8241/8589392310_7b6127e243_b.jpg" title="Caption. Can be aligned it to any side.">
    <img src="http://farm9.staticflickr.com/8241/8589392310_7b6127e243_s.jpg" width="75" height="75">
</a><h2>Sub-title</h2><p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
    <p><strong>LOREM IPSUM</strong></p>
          <h3>Tel. +123 456.789 - E-mail: contact@kjhhklh.com</h3>
  </div>


    </div>

<div class="footer">
      <p class="left">contact@mydomain.com | + 12 345.678.910</p>
      <p class="right">contact@mydomain.com | + 12 345.678.910</p>
    </div>
</body>
</html>

CSS:

/* Footer
/* -------------------------------------------- */
.footer {
    position: fixed;
    z-index: 300;
    bottom: 0;
    width: 100%;
    min-width: 768px;
    max-width: 1950px;
    margin: 0 auto;
    background: #2b2b2b;
}
.footer a {
    color: #fff;
    text-transform: uppercase;
    border-bottom-color: #2b2b2b;
}
.footer a:hover {
    border-bottom-color: #ECB825;
}
.footer p.left {
    display: inline-block;
    float: left;
    color: #fff;
    padding-left: 20px;
    vertical-align: middle;
    font-family: 'Futura W01 Heavy', Arial, sans-serif;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    padding-bottom: 1px;
}
.footer p.right {
    display: inline-block;
    float: right;
    padding-right: 20px;
    color: #fff;
    padding-left: 20px;
    vertical-align: middle;
    font-family: 'Futura W01 Heavy', Arial, sans-serif;
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    padding-bottom: 1px;
}
4

3 回答 3

2

我将对您的 CSS 进行以下调整:

.footer {
    height: 50px;
    line-height: 50px;
    vertical-align: middle;
}

.footer p.left {
    xxvertical-align: middle;
    xxline-height: 1;
}
.footer p.right {
    xxvertical-align: middle;
    xxline-height: 1;
}

声明heightline-height在你.footer的某个固定值。p.left删除和中的这两个属性p.right

只要您有单行内容,这应该没问题。

小提琴:http: //jsfiddle.net/audetwebdesign/hqdP2/4/

于 2013-05-09T20:41:35.403 回答
1

一种可能的解决方案是调整和中的line-height值。根据您现有的示例,类似的东西会出现垂直对齐。或者你应该设置一个in并使你的in等于in 。.footer p.left.footer p.rightline-height: 2.0emheight.footerline-height.footer p.left.footer p.rightheight.footer

于 2013-05-09T20:28:09.067 回答
1

.footer p有一个底部边距。用顶部和底部边距覆盖它,例如:

.footer p {
    margin: 10px 0;
}
于 2013-05-09T20:29:54.310 回答