这是我想要实现的目标:
以下是容器的图像:
这是一些代码......
HTML:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="pageWrapper">
<div class="contentWrapper">
<span class="top-left"></span>
<span class="top-middle"></span>
<span class="top-right"></span>
<span class="bottom-left"></span>
<span class="bottom-middle"></span>
<span class="bottom-right"></span>
<div class="content">
<p>
Lorem ipsum dotor sit amet, consectetur adipiscing elit.
Ut viverra lectus vitae est ullamcorper a tempus est commodo.
Phasellus et pulvinar risus. Cras quis aliquet odio. Ut condimentum porta mi ultrices elementum.
Maecenas feugiat magna at tellus convallis congue. Aenean tincidunt rutrum varius. Aenean nec eros id odio dapibus faucibus.
Pellentesque blandit gravida erat id sodales. Etiam nunc odio, pharetra nec aliquam a, gravida at metus. Nullam dapibus vulputate blandit.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum ullamcorper lectus ut sapien scelerisque
vitae ullamcorper mauris venenatis.
</p>
</div>
</div>
</div>
</body>
CSS:
body {
background-color: #eeeee7;
}
.pageWrapper {
margin: 0px auto; /* centers the div horizontally */
min-width: 900px;
min-height: 430px;
height: 80%;
width: 80%;
background-color: red;
}
.contentWrapper {
position: relative; /* makes our corners absolute relative to our container not our browser window */
background-color: yellow;
height: 100%;
width: 100%;
padding-right: 34px;
padding-left: 34px;
padding-top: 155px;
}
.top-left,
.top-right {
position: absolute;
height: 155px;
width: 34px;
background-color: blue;
}
.bottom-left,
.bottom-right {
position: absolute;
height: 29px;
width: 34px;
}
.top-left {
top: 0;
left: 0;
background-image:url('images/cornerLeftTop.jpg');
}
.top-right {
top: 0;
right: 0;
background-image:url('images/cornerRightTop.jpg');
}
.bottom-left {
bottom: 0;
left: 0;
background-image:url('images/cornerBottomLeft.jpg');
}
.bottom-right {
bottom: 0;
right: 0;
background-image:url('images/cornerBottomRight.jpg');
}
.top-middle {
position: absolute;
top: 0;
left: 34px;
height: 155px;
width: 100%;
background-image:url('images/headerMiddle.jpg');
}
.bottom-middle {
position: absolute;
bottom: 0;
height: 29px;
width: 100%;
background-image:url('images/footerMiddle.jpg');
}
.middle-left {
}
.middle-right {
}
答案 0 :(得分:0)
这对我有用,我仍然在完善最小宽度,但在&lt;即8.我意识到有现代方法可以做到这一点。但是,我在一个必须仍然支持一些即6个用户的地方工作。这有效!
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="pageWrapper">
<div class="contentWrapper">
<div class="headerMiddle">
</div>
<span class="top-left"></span>
<span class="top-right"></span>
<div class="contentRight">
</div>
<div class="contentLeft">
</div>
<div class="content">
<p>
Lorem ipsum dotor sit amet, consectetur adipiscing elit.
Ut viverra lectus vitae est ullamcorper a tempus est commodo.
Phasellus et pulvinar risus. Cras quis aliquet odio. Ut condimentum porta mi ultrices elementum.
Maecenas feugiat magna at tellus convallis congue. Aenean tincidunt rutrum varius. Aenean nec eros id odio dapibus faucibus.
Pellentesque blandit gravida erat id sodales. Etiam nunc odio, pharetra nec aliquam a, gravida at metus. Nullam dapibus vulputate blandit.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum ullamcorper lectus ut sapien scelerisque
vitae ullamcorper mauris venenatis.
</p>
<p>
Lorem ipsum dotor sit amet, consectetur adipiscing elit.
Ut viverra lectus vitae est ullamcorper a tempus est commodo.
Phasellus et pulvinar risus. Cras quis aliquet odio. Ut condimentum porta mi ultrices elementum.
Maecenas feugiat magna at tellus convallis congue. Aenean tincidunt rutrum varius. Aenean nec eros id odio dapibus faucibus.
Pellentesque blandit gravida erat id sodales. Etiam nunc odio, pharetra nec aliquam a, gravida at metus. Nullam dapibus vulputate blandit.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum ullamcorper lectus ut sapien scelerisque
vitae ullamcorper mauris venenatis.
</p>
</div>
<div class="footerMiddle">
</div>
<span class="bottom-left"></span>
<span class="bottom-right"></span>
</div>
</div>
</body>
body {
background-color: #eeeee7;
text-align:center;
}
.pageWrapper {
margin: 0px auto; /* centers the div horizontally */
min-width: 900px;
height: 768px;
width: 80%;
}
.contentWrapper {
position: relative; /* makes our corners absolute relative to our container not our browser window */
background-color: white;
height: 100%;
width: 100%;
padding-top: 155px;
text-align: left;
}
.content {
padding: 75px;
}
.headerMiddle {
position: absolute;
top: 0;
left: 0;
height: 155px;
width: 100%;
background-image:url('images/headerMiddle.jpg');
}
.footerMiddle {
position: absolute;
bottom: 0;
right: 0;
height: 29px;
width: 100%;
background-image:url('images/footerMiddle.jpg');
}
.contentLeft {
float: left;
height: 100%;
width: 34px;
background-image:url('images/contentLeft.jpg');
}
.contentRight {
float: right;
height: 100%;
width: 34px;
background-image:url('images/contentRight.jpg');
}
.top-left,
.top-right {
position: absolute;
height: 155px;
width: 34px;
background-color: blue;
}
.top-left {
top: 0;
left: 0;
background-image:url('images/cornerLeftTop.jpg');
}
.top-right {
top: 0;
right: 0;
background-image:url('images/cornerRightTop.jpg');
}
.bottom-left,
.bottom-right {
position: absolute;
height: 29px;
width: 34px;
}
.bottom-left {
bottom: 0;
left: 0;
background-image:url('images/cornerBottomLeft.jpg');
}
.bottom-right {
bottom: 0;
right: 0;
background-image:url('images/cornerBottomRight.jpg');
}
.minWidth {
width: 600px;
height:1px;
}