普通网友 2018-03-21 13:47
浏览 56
已采纳

如何将JPG图像设置为PHP文件的背景? [关闭]

I want to set a JPG Image from the same folder as a background for this page. Can anyone tell me how this can be done for this page. I tried adding it to the start of the body but does not show up.

<?php 
 session_start();  
 if(isset($_SESSION["user"]))  
 {  
      header("location:home.php");  
 }  

 ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>SUNRISE ADMIN</title>
  <link rel="stylesheet" href="css/style.css"> 
</head>

<body>

<h3><a href="../index.html">SUNRISE HOMEPAGE</a></h3></div>

 <div class="container">

 <h2>Sunrise Admin Login</h2>
      <div id="login">

        <form method="post">

          <fieldset class="clearfix">

            <p><span class="fontawesome-user"></span><input type="text"  name="user" value="Username" onBlur="if(this.value == '') this.value = 'Username'" onFocus="if(this.value == 'Username') this.value = ''" required></p> <!-- JS because of IE support; better: placeholder="Username" -->
            <p><span class="fontawesome-lock"></span><input type="password" name="pass"  value="Password" onBlur="if(this.value == '') this.value = 'Password'" onFocus="if(this.value == 'Password') this.value = ''" required></p> <!-- JS because of IE support; better: placeholder="Password" -->
            <p><input type="submit" name="sub"  value="Login"></p>

          </fieldset>

        </form>



      </div> <!-- end login -->

    </div>

</body>
</html>
  • 写回答

1条回答 默认 最新

  • douhoulei4706 2018-03-21 13:55
    关注

    Edit <body>

    With: <body style="background-image:url('/location/to/image.jpg');">

    or you can add it into your css stylsheet

    body {
            background-image:url('https://image.ibb.co/iXFDPc/Schermafbeelding_2015_06_11_om_11_50_14_grande_1.png');    
            background-repeat: no-repeat;
            background-attachment: fixed;
            background-position: center; 
        }
    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
    </head>
    <body>
    
    </body>
    </html>

    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改