普通网友 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 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法