Bootstrap背景图像不显示

时间:2015-06-09 08:52:50

标签: twitter-bootstrap

I am trying to put back ground image for my bootstrap web page but that is not show Please refer this link and see my progress work

我试图放回地面图像但是在自举格式下它不能以正常格式显示它显示什么是问题请帮帮我

/* Sticky footer styles
-------------------------------------------------- */
html{
    /* This image will be displayed fullscreen */
    background-image:url('http://p1.pichost.me/i/72/1968716.jpg');

    /* Ensure the html element always takes up the full height of the browser window */
    min-height:100%;

    /* The Magic */
    background-size:cover;
}

body{
    /* Workaround for some mobile browsers */
    min-height:100%;
}

/* Wrapper for page content to push down footer */
#wrap {
  min-height: 100%;
  height: auto !important;
  height: 100%;
  /* Negative indent footer by its height */
  margin: 0 auto -120px;
  /* Pad bottom by footer height */
  padding: 0 0 120px;
}

/* Set the fixed height of the footer here */
#footer {
  height: 60px;
  background-color: #f5f5f5;
  margin-top:50px;
  padding-top:20px;
  padding-bottom:20px;
}


/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */


.panel-transparent {
        background: none;
    }

   .panel-transparent .panel-body{
        background: rgba(245, 245, 245, 0.2)!important;
    }

#wrap > .container {
  padding: 60px 15px 0;
}
.container .credit {
  margin: 20px 0;
}

#footer > .container {
  padding-top: 20px;
  padding-left: 15px;
  padding-right: 15px;
}

#footer {
  background-color:#414141;
}


code {
  font-size: 80%;
}
<!-- Wrap all page content here -->
<div id="wrap">
  
  <!-- Fixed navbar -->
<nav class="navbar navbar-inverse">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
      <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
     
      <ul class="nav navbar-nav navbar-right">
        <li onclick="view()"><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
        <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
      </ul>
    </div>
  </div>
</nav>
  
  <!-- Begin page content -->
  <div class="container">
    <div class="panel panel-primary  panel-transparent"  id="login">
      <div class="panel-heading">User Login</div>
      <div class="panel-body">
     <div class="jumbotron">
        <form class="form-horizontal" role="form">
  <div class="form-group">
    <label class="control-label col-sm-2" for="email">Email:</label>
    <div class="col-sm-10">
      <input class="form-control" id="email" placeholder="Enter email" type="email">
    </div>
  </div>
  <div class="form-group">
    <label class="control-label col-sm-2" for="pwd">Password:</label>
    <div class="col-sm-10">
      <input class="form-control" id="pwd" placeholder="Enter password" type="password">
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <div class="checkbox">
        <label><input type="checkbox"> Remember me</label>
      </div>
    </div>
  </div>
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-default">Submit</button>
    </div>
  </div>
</form>
       
       
        </div>
     </div>
    </div>
    
    
  </div>
</div>

<div id="footer">
  <div class="container">
      	<div class="row">
          <p class="text-muted">This Bootstrap Example courtesy <a href="http://www.bootply.com">Bootply.com</a></p>
		</div><!--/row-->
    
  </div><!--/container-->
</div>

1 个答案:

答案 0 :(得分:1)

JS Fiddle

body添加背景样式。正文将覆盖HTML,并且正文的默认颜色为白色,您的图像不会显示在正文中。

[编辑#1]

更好的解决方案是将背景样式保留在html上,并将background: none;添加到正文中。通过这种方式,整个屏幕将被覆盖,内容将可滚动而不是图像加,图像不会重复。就页脚间距而言,我建议您清理代码。那会好的。您可能写了一些无效的HTML。

附注:运行JSFiddle以测试它是否有效。不要每次都按保存。你像8615次更新了你的小提琴。