我想创建一个以照片为背景的网页,背景是屏幕宽度的 300%,并且每 33.33333% 有一张居中的响应式照片,因此它可以保持其比例方面。
我的html代码:
<!DOCTYPE html>
<html>
<head>
<title>aj</title>
<link href="design.css" rel="stylesheet" type="text/css">
<body/>
<div id="background"><img src="background.png"/> </div><!--These is the background image that should be displayed behind the other 3 images it is 1523x993 and i don't
know how to make it stretch to be 3 time the size of the of the window -->
<div id="dvScreen1"><img src="2(1).png"/></div><!--These is one of the 3 photos that will be displayed above the background image,
I want to make it centered in the window and responsive so if the window height changes than also its wide should change and the position
should remain centered so that it won't display the next photo if the user makes the height of the window very small and the wide very large -->
<div id="dvScreen2"><img src="l1.png"/></div><!-- these will be the second photo and should have the same properties as the first and should come to the right of the firs, between the first and the second -->
<div id="dvScreen3"><img src="l1.png"/></div> <!-- these photo will be the last so it will be floated left and will have the same responsive properties as the both will remain
centered and resize automatically on the x and y axes if the user resizes the window on y axes or the x axes--!>
</body>
</html>
我的 CSS 代码:
body{
height: 100%;
overflow-x:vizible;
width:300%;
margin:0%;
padding:0%;
overflow-y:hidden;
position;fixed;
}
#dvScreen1, #dvScreen2,#divScreen3{
width:33.3333%;
height:100%;
clear:none;
}
#dvScreen1 {
margin-left:0%;
border:solid red 1px;
margin-top:-100%;
}
#dvScreen2 {
margin-left:33.33333%;
border:solid black 1px;
text-align:center;
margin-top:0%;
}
#dvScreen3{
margin-left:66.66666%;
border:solid blue 1px;
text-align:center;
margin-top:0%;
}
#background{
min-width:100%;
margin:0%;
padding:0%;
}
感谢您对代码的任何帮助