CSS背景未在浏览器上显示

时间:2015-04-15 19:28:46

标签: html css twitter-bootstrap

我的css背景图片显示在Dreamweaver上但不在我的谷歌浏览器浏览器中由于某种原因它只显示白色背景可以让任何人理解为什么?这是我的代码:

about.php文件

<?php
include 'secure/db_connect.php';
include 'secure/functions.php';
sec_session_start(); // Our custom secure way of starting a php session.
if(login_check($mysqli) == true) { ?>
<!DOCTYPE html>
<html lang="en">
<head>
  <title>The Referee Perception Exam</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="css/aboutstyle.css" rel="stylesheet" type="text/css" media="screen" />
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>


<div class="container">
  <div class="jumbotron">
    <h1>title</h1>
    <p>paragraph here</p> 
  </div>
  <div class="row">
    <div class="col-sm-4">
      <h3>Contact:</h3>

    </div>
    <div class="col-sm-4">
      <h3>Social:</h3>

    </div>
    <div class="col-sm-4">
      <h3>Column 3</h3>        

    </div>
  </div>
</div>

</body>
</html>
<?php } else {
   header( 'Location: http://localhost/project/index.php' ) ;
}

;?>

aboutstyle.css文件

@charset "UTF-8";
body {
      background-image: url("../img/pitch.jpeg");
    background-color: #cccccc;
    background-size:cover;
}

1 个答案:

答案 0 :(得分:1)

从文件结构中猜测我可以看到你可能需要改变

background-image: url("../img/pitch.jpeg");

也许

background-image: url("../../img/pitch.jpeg");

或类似于从样式表中正确访问图像文件。但是如果没有看到结构,我无法确定。浏览器中的404错误应该指向正确的方向。