我正在处理的网页只有一个主内容div,它被固定了大小。我希望可以通过浏览器窗口滚动条来滚动它,而不是“div中”的滚动条。
内容div的大小为1076px宽,475px高。
基本上,我已经在一个浮动div中放置了一个边缘淡化的图像,实际上在我的内容div上方,所以如果我使用div内部的滚动条,我将无法选择它或单击它,因为浮动div的原因。因此,我正在寻求一些帮助来使我的布局能够使用滚动条。
我一直在尝试使这个页面正常工作,但我不知道如何完成这个任务,特别是考虑到我的布局。这是我测试链接的地址:
所需翻译内容如下:
内容div的大小为1076px宽,475px高。
基本上,我已经在一个浮动div中放置了一个边缘淡化的图像,实际上在我的内容div上方,所以如果我使用div内部的滚动条,我将无法选择它或单击它,因为浮动div的原因。因此,我正在寻求一些帮助来使我的布局能够使用滚动条。
我一直在尝试使这个页面正常工作,但我不知道如何完成这个任务,特别是考虑到我的布局。这是我测试链接的地址:
http://184.66.76.75/gxwd_v2/
所需翻译内容如下:
所以我想要的是使用浏览器的主滚动条来滚动“maincontent” div,它具有固定大小。当内容大于固定大小时,您可以向下滚动内容。对于我的布局,如果我要在div内使用div滚动条。你无法滚动,因为div不是“活动的”。不仅如此,由于我的content_overlap div浮动在内容框上方,因此您也无法选择该div。
CSS文件:
body {
background-color: #000000;
background-image: url(images/background.png);
background-repeat: no-repeat;
background-position: center;
margin: 0px auto;
padding: 0px;
color: #000000;
overflow: hidden;
}
/* ~~ this fixed width container surrounds all other elements ~~ */
.container {
width: 1076px;
height: 530px;
margin: 220px auto; /* the auto value on the sides, coupled with the width, centers the layout */
}
/* ~~ This is the layout information. ~~ */
.menu {
width: 800px;
margin-left: 13%;
margin-right: 13%;
text-align: center;
}
.content {
padding: 0px 0px;
}
.content_overlap {
width: 1079px;
height: 504px;
background-image: url(images/fade.png);
background-position: top;
background-repeat: no-repeat;
position: absolute;
top: 252px;
left: 50%;
margin-left: -538px;
}
.maincontent {
position: relative;
top: 20px;
max-width: 1076px !important;
max-height: 460px !important;
overflow: auto;
padding: 0px 0px 0px 0px;
}
PHP文件:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>GuberX Web Development & Design</title>
<link rel="stylesheet" type="text/css" href="oneColFixCtr.css">
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="mobile.css">
<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)" type="text/css" href="iphone4s.css" />
<link rel="stylesheet" media="only screen and (min-device-width: 481px)" href="desktop.css" type="text/css">
<meta name="viewport" content="initial-scale=0.5">
</head>
<body>
<div class="container">
<div class="content">
<div class="menu"><img src="images/menu/home-1.png"><img src="images/menu/spacer.png"><img src="images/menu/portfolio-1.png"><img src="images/menu/spacer.png"><img src="images/menu/services-1.png"><img src="images/menu/spacer.png"><img src="images/menu/contact-1.png"></div>
<div class="maincontent">
Test Possition of Text and whatnot1<br />
Test Possition of Text and whatnot2<br />
Test Possition of Text and whatnot3<br />
Test Possition of Text and whatnot4<br />
Test Possition of Text and whatnot5<br />
Test Possition of Text and whatnot6<br />
Test Possition of Text and whatnot7<br />
Test Possition of Text and whatnot8<br />
Test Possition of Text and whatnot9<br />
Test Possition of Text and whatnot10<br />
Test Possition of Text and whatnot11<br />
Test Possition of Text and whatnot12<br />
Test Possition of Text and whatnot13<br />
Test Possition of Text and whatnot14<br />
Test Possition of Text and whatnot15<br />
Test Possition of Text and whatnot16<br />
Test Possition of Text and whatnot17<br />
Test Possition of Text and whatnot18<br />
Test Possition of Text and whatnot19<br />
Test Possition of Text and whatnot20<br />
Test Possition of Text and whatnot21<br />
Test Possition of Text and whatnot22<br />
Test Possition of Text and whatnot23<br />
Test Possition of Text and whatnot24<br />
Test Possition of Text and whatnot25<br />
Test Possition of Text and whatnot26<br />
Test Possition of Text and whatnot27<br />
Test Possition of Text and whatnot28<br />
Test Possition of Text and whatnot29<br />
Test Possition of Text and whatnot30<br />
</div>
</div><!-- end .content -->
<div class="content_overlap"></div> <!-- This div has a background image that has fading edges for the content box --!>
</div><!-- end .container -->
</body>
</html>