对齐页脚文本中心的问题

用户名

在添加引导程序投资组合网格模板后,我很难将文本居中放置在页脚中。宽度已经是100%,并且文本在CSS中也居中对齐。有人知道我的代码在做什么错吗?

/* Sticky footer styles
-------------------------------------------------- */
html {
  position: relative;
  min-height: 100%;
}
body {
  /* Margin bottom by footer height */
  margin-bottom: 40px;
}
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  /* Set the fixed height of the footer here */
  height: 60px;
  line-height: 60px; /* Vertically center the text there */
  text-align: center;
  color: #bababa;
  background-color: #ffffff;
  font-size: 11px;
  font-family: 'Nunito Sans', sans-serif;
}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8"/>
  <meta name="viewport" content="width=device=width, initial-scale=1, shrink-to-fit=no"">
  <title>Jenny Hua</title>
  <link rel="icon" type="image/png" href="img/icon.png"/>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <link rel="stylesheet" type="text/css" href="css/style.css" />
  <link rel="stylesheet" type="text/css" href="css/simplegrid.css" />
  <link href="css/sticky-footer.css" rel="stylesheet">
  <link href="css/narrow-jumbotron.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Nunito|Nunito+Sans|Playfair+Display|Roboto:300|Cedarville+Cursive" rel="stylesheet">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
  <!-- Latest compiled and minified CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  <!-- Latest compiled and minified JavaScript -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  </head>
<body>
  <header>
     <div class="container navbar-container navbar-fixed-top" role="navigation">
  <div class="navbar navbar-default">
    <div class="container-fluid">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
              <a class="navbar-brand" href=""><img onload="this.style.opacity='1!important';" class= "logo" src="img/logo.png"></a>
      </div>
      <div id="navbar" class="navbar-collapse collapse">
        <ul class="nav navbar-nav">
           <li class="navbar-left"><a href="http://wwwl">TRAVEL</a></li>
           <li class="navbar-left active"><a href="http://www"> PORTFOLIO </a></li>
           <li class="navbar-left"><a href="http://www> INSPO </a></li>
           <li class="navbar-left"><a href="http://w> ABOUT </a></li>
        </ul>
        <ul class="nav navbar-nav navbar-right">
      <li class="right"> <a href="https://www.instagram.com/"><i class="fa fa-instagram"></i></a>
      <li class="right"> <a href="https://www.pinterest.com/"><i class="fa fa-pinterest"></i></a>
      <li class="right"> <a href="https://www.facebook.com/"><i class="fa fa-facebook"></i></a>
      <li class="right"> <a href="https://twitter.com/"><i class="fa fa-twitter"></i></a>  
        </ul>
      </div>
      <!--/.nav-collapse -->
    </div>
    <!--/.container-fluid -->
  </div>
</div>
  </header>
<!---End Header-->
<style>
      .content {
        background: #ffffff;
        font-family: 'Roboto', sans-serif;
        color: #4a4a4a;
        font-size:15px;
      }
</style>

 <!-- Page Content -->
    <div class="container">

        <!-- Page Heading -->
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">Page Heading
                    <small>Secondary Text</small>
                </h1>
            </div>
        </div>
        <!-- /.row -->

        <!-- Project One -->
        <div class="row">
            <div class="col-md-7">
                <a href="#">
                    <img class="img-responsive" src="http://placehold.it/700x300" alt="">
                </a>
            </div>
            <div class="col-md-5">
                <h3>Project One</h3>
                <h4>Subheading</h4>
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium veniam exercitationem expedita laborum at voluptate. Labore, voluptates totam at aut nemo deserunt rem magni pariatur quos perspiciatis atque eveniet unde.</p>
                <a class="btn btn-primary" href="#">View Project <span class="glyphicon glyphicon-chevron-right"></span></a>
            </div>
        </div>
        <!-- /.row -->

        <hr>

        <!-- Project Two -->
        <div class="row">
            <div class="col-md-7">
                <a href="#">
                    <img class="img-responsive" src="http://placehold.it/700x300" alt="">
                </a>
            </div>
            <div class="col-md-5">
                <h3>Project Two</h3>
                <h4>Subheading</h4>
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut, odit velit cumque vero doloremque repellendus distinctio maiores rem expedita a nam vitae modi quidem similique ducimus! Velit, esse totam tempore.</p>
                <a class="btn btn-primary" href="#">View Project <span class="glyphicon glyphicon-chevron-right"></span></a>
            </div>
        </div>
        <!-- /.row -->

        <hr>

        <!-- Project Three -->
        <div class="row">
            <div class="col-md-7">
                <a href="#">
                    <img class="img-responsive" src="http://placehold.it/700x300" alt="">
                </a>
            </div>
            <div class="col-md-5">
                <h3>Project Three</h3>
                <h4>Subheading</h4>
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Omnis, temporibus, dolores, at, praesentium ut unde repudiandae voluptatum sit ab debitis suscipit fugiat natus velit excepturi amet commodi deleniti alias possimus!</p>
                <a class="btn btn-primary" href="#">View Project <span class="glyphicon glyphicon-chevron-right"></span></a>
            </div>
        </div>
        <!-- /.row -->

        <hr>

        <!-- Project Four -->
        <div class="row">

            <div class="col-md-7">
                <a href="#">
                    <img class="img-responsive" src="http://placehold.it/700x300" alt="">
                </a>
            </div>
            <div class="col-md-5">
                <h3>Project Four</h3>
                <h4>Subheading</h4>
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Explicabo, quidem, consectetur, officia rem officiis illum aliquam perspiciatis aspernatur quod modi hic nemo qui soluta aut eius fugit quam in suscipit?</p>
                <a class="btn btn-primary" href="#">View Project <span class="glyphicon glyphicon-chevron-right"></span></a>
            </div>
        </div>
        <!-- /.row -->

        <!-- /.row -->
  <!-- End page content -->
    <footer class="footer">
      <div class="container">
        <span style="text-align: center">Copyright &copy; 2017. J. All rights reserved.</span>
      </div>
    </footer>
<!---End Footer-->
<!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>

毗湿奴

加入right:0; left:0;页脚样式

.footer {
    right: 0;
    left: 0;
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60px;
    line-height: 60px;
    text-align: center;
    color: #bababa;
    background-color: #ffffff;
    font-size: 11px;
    font-family: 'Nunito Sans', sans-serif;
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Bootstrap页脚中的文本与中心对齐

来自分类Dev

页脚对齐问题

来自分类Dev

UITableViewCell文本对齐中心

来自分类Dev

如何正确对齐页脚文本

来自分类Dev

Excel VBA 中心页眉/页脚“左对齐”

来自分类Dev

将文本中心与图像中心对齐

来自分类Dev

歌剧的文本对齐中心-CSS

来自分类Dev

如何文本对齐图像的中心?

来自分类Dev

粘性页脚文本问题-CSS

来自分类Dev

页脚div文本不会对齐

来自分类Dev

将固定页脚中的文本与容器对齐

来自分类Dev

页脚div文本不会对齐

来自分类Dev

文本框对齐输入文本中心

来自分类Dev

<td>文本中心,但文本左对齐

来自分类Dev

带有文本对齐中心的Safari 6.1 / 7.0中的CSS单词间距问题

来自分类Dev

在每个pdf页面上添加页脚和页脚对齐的文本

来自分类Dev

将社交图标对齐到页脚中心

来自分类Dev

如何在 React 的嵌套组件场景中使页脚与中心对齐

来自分类Dev

文本对齐:中心不居中锚标签

来自分类Dev

字母间距错误的文本中心对齐

来自分类Dev

将文本对齐到菜单li的中心

来自分类Dev

对齐文本中心无法正常工作

来自分类Dev

将文本对齐到图标的中心

来自分类Dev

Chrome中的文本对齐中心(Webkit)

来自分类Dev

在SVG圆下方对齐文本中心?

来自分类Dev

为什么文本标题中心对齐?

来自分类Dev

围绕ImageSpan中心垂直对齐文本

来自分类Dev

如何使用jspdf在中心对齐文本

来自分类Dev

对齐语义UI文本菜单中心