无法设置背景图像

时间:2016-04-01 19:05:01

标签: php html css

我试图在此文件中设置背景图像为indx.php 我尝试了这个,但它不起作用背景仍然是空白。但是如果我成功地将index.html的扩展名更改为了。我没有得到代码中的错误。为什么它表现得像这样。

<html>
    <head>
    <style>
     body
      {
        background-image: url("back.jpg");
        background-position:0px 0px;
    background-size: cover;
        background-repeat: repeat;
      }
    </style>
    </head>
    <body>
    <style>
    table{
        border-spacing:15px;
    }
    td{
        padding:30px;
    }
     body
      {
        background-image: url(back.jpg);
    background-size: cover;
        background-repeat: repeat;
      }
    </style>
    </body>
    <?php

    require "connect.php";

      $sql="select * from nbook";
    $row = $conn->query($sql);
    $n=0;
    echo"<form method='post'><table border='0' align='center'><tr>";
        while($arr = $row->fetch_assoc()) 
        {
               $i=$arr['BookId'];
        if($n%3==0)
        {
        echo "<tr>";
        }
       echo "
        <td height='280' width='240' align='center'><img src='data:image/jpg;base64,".base64_encode( $arr['BookImage'] )."'height='250' width='200'><br/>
        <b>BOOKNAME:</b>".$arr['BOOKNAME']."
       <br><b>Author:</b>".$arr['Author']."
       <br><b>Publication:</b>&nbsp;".$arr['PublicatonHouse']."
       <br><b>Discount:</b>".$arr['Discount']."%
       <br><br><img src='images/MetalPlakDa5new.gif' width='70' height='20'/></a>
       <img src='images/view7.jpg' width='70' height='20'/></a>
       </td>";
      $n++;
        }




          echo "</tr></table>
           </form>";
        ?>

    </body>
    </html>

1 个答案:

答案 0 :(得分:0)

得到了我自己的答案 实际上图像在那里,但它正在滑动并消失所以

background-position:0px 0px;
background-attachment:fixed;

这两件事应该添加

相关问题