[英]<img id=“background”>.. nothing showing up?
我只是不明白為什么背景位於文本頂部。我真的很感謝任何幫助。
謝謝
html
<body>
...
<img...>
<div>
<div>
drop down list
<div>
<div>
body>img{
這是背景選項,希望它調整高度和寬度
/ *設置規則以填充背景* /最低高度:100%; 最小寬度:1024px;
/* Set up proportionate scaling */
width: 100%;
height: auto;
/* Set up positioning */
position: fixed;
top: 0;
left: 0;
}
#wrap{
max-width: 1000px;
margin: 20px 0px;
display:-webkit-box;
-webkit-box-flex: 1;
padding-top: 30px;
}
/* link styles und so */
a:hover{
cursor:pointer;
}
a{
text-decoration: none;
font-family: 'Sintony', sans-serif;
color:black;
}
/* drop down list */
.clear{
clear:both;
}
ul#nav{
list-style-type: none;
padding: 0;
margin-top:60px;
}
ul#nav li{
background-color: white;
float:left;
}
ul#nav li a{
display:block;
padding: 5px 10px;
color:#000;
text-decoration: none;
border-bottom: 1px solid #ccc;
list-style-type: none;
}
ul#nav li a:hover{
background-color: #aaa;
}
ul#nav li ul li{
float: none;
list-style-type: none;
}
ul#nav li ul{
position: absolute;
display:none;
}
ul#nav li:hover ul{
display: block;
}
使用CSS設置背景
正文{background-image:url('yourfilepath'); 背景顏色:#cccccc; }
如果您不想使用background-image元素,而又想使用img元素,那么應該使用z-index屬性。 在這里您可以玩。
此處為示例: http : //www.w3schools.com/cssref/tryit.asp?filename=trycss_zindex
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.