HTML Div不会滚动
目前我正在制作一个网站。我将图像输入到一个div中,然后文本覆盖该图像来描述它。我把文本放在图像上,然后把不透明度设为.5。我的代码的问题是文本不会滚动。滚动条已显示,但不起作用 我的HTMLHTML Div不会滚动,html,css,Html,Css,目前我正在制作一个网站。我将图像输入到一个div中,然后文本覆盖该图像来描述它。我把文本放在图像上,然后把不透明度设为.5。我的代码的问题是文本不会滚动。滚动条已显示,但不起作用 我的HTML <!DOCTYPE html> <html> <head> <link type="text/css" rel="stylesheet" href="style.css"/> <style type="text/css">
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="style.css"/>
<style type="text/css">
<!--
body {
margin: 0px;
}
-->
</style>
</head>
<body>
<div id="wrapper">
<div id="background">
<h10>.</h10>
</div>
<div id="header">
<div id="logobackground">
<img src="http://localhost/cabinchic/logo.png">
</div>
<div id="navbar">
<a href="http://localhost/cabinchic/home.html">
<div id="homebutton">
<h1> Home </h1>
</div>
</a>
<a href="http://localhost/cabinchic/homedecor.html">
<div id="homedecorbutton" style="border-radius: 8px; color: #00693E;;background-image: url(http://localhost/cabinchic/woodplankgreen.jpg)">
<h1> Home Decor </h1>
</div>
</a>
<a href="http://localhost/cabinchic/askheather.html">
<div id="askheatherbutton">
<h1> Ask Heather </h1>
</div>
</a>
</div>
</div>
<div id="leftbox">
</div>
<div id="mainbox">
<div class="picture" style="background-image: url(http://localhost/cabinchic/stones.jpg)">
<div class="text">
<h1> 26473264738654356427564 gyugfyubyeefwafwaf67erafh6ea7f67webf7bqyeuiewHFUIWhf78whiuNEuiwehui </h1>
</div>
</div>
</div>
<div id="footer">
<div id="footerborder">
<h10>.</h10>
</div>
<center>
<img src="http://localhost/cabinchic/logo.png" style="max-height: 18%; margin-top: -2%">
<div id="footertextcr"> <h1>All Rights Reserved © 2014 Python Daily</h1> </div>
<div id="footertext"> <h1>Logo made by Fatpaint | Site made by Michael Jones</h1> </div>
</center>
</div>
</div>
</body>
</html>
很抱歉,CSS代码中没有空格,它没有正确粘贴…问题#1:页眉的高度为100%,宽度为100%,固定在页面上,因此覆盖了div和滚动条,并取消了滚动功能。
问题2:
文本的容器#mainbox的z索引为-1,因此将其及其子项置于其他所有内容之后:
#mainbox {
width: 76%;
height: 100%;
position: absolute;
margin-top: 20.4%;
margin-left: 22%;
background-image: url("http://localhost/cabinchic/barkbrown.jpg");
border-radius: 8px;
border: 1px solid black;
/*background-size: 100%;*/
}
代码太多了……谢谢!!!我修正了代码,使标题的高度为25%,索引为10。然后我把主索引设为0。@user3600560很高兴我能帮助你!
#mainbox {
width: 76%;
height: 100%;
position: absolute;
margin-top: 20.4%;
margin-left: 22%;
background-image: url("http://localhost/cabinchic/barkbrown.jpg");
border-radius: 8px;
border: 1px solid black;
/*background-size: 100%;*/
}