簡體   English   中英

樣式-背景圖片未顯示

[英]Style - background-image not showing

有人可以告訴我為什么我的背景圖片沒有顯示嗎? 這是我的style.css布局嗎? 我已經嘗試了許多代碼,但是由於某種原因,圖像不會顯示。 請幫助我,這是一個項目。

<style>

.body {
  background-image: url('http://i58.tinypic.com/2ngegih.png'); 
  background-repeat: repeat-y;
  background-position: left top;
  font-family: arial;
  font-size: 10pt;
}


#heading {
  text-align: center;

}

#left {
  float: left;
  padding: 0px 10px 0px 0px;
  width: 200px;
}

#middle {
  top: 10px;
  margin-left: 100px;
  margin-right: 700px;
  width: 810px;



}

#right {
  float: right;
  padding: 0px 10px 0px 10px;
  width: 90px;
}
 <style>

這是我的標題頁:

<div id="heading">
<div class="heading">

<title>MediaBuzz</title>
<center><img src="http://i59.tinypic.com/vdjsqx.jpg">
</center>
</div></div>

這是索引頁面。 所有這些頁面都是我剛開始就擁有的所有頁面。

<?php
include('header.php');
?>

<div id="left">
<div class="left">
this is the left column
</div></div>


<div id="middle">
<div class="middle">

this is the middle column 
</div></div>

</style>
</div>
  • 您無需花費時間來選擇body元素。 不知道您是否使用body作為類名。 請發布HTML頁面的其余部分。
  • 該URL指向HTML頁面,但不指向原始圖像本身。 嘗試使用http://oi58.tinypic.com/2ngegih.jpg

編輯:

那是無效的HTML。

body元素或類不存在,因此不會應用您的CSS聲明。 您需要學習HTML頁面的基本結構。 利用W3C驗證程序: http : //validator.w3.org/

您還需要運行一個PHP服務器來解釋其中的PHP代碼。

以下代碼可以回答您的問題:

<!DOCTYPE html>
<html>
<head>
<title>MediaBuzz</title>
<style>
    html {
        height: 100%;
        width: 100%;
    }
body  {
    height: 100%;
    width: 100%;
    background-image: url("http://oi58.tinypic.com/2ngegih.jpg");
}
</style>
</head>
<body>

<!-- the rest of the HTML goes in here -->

</body>
</html>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM