您可以尝试使用此代码。http://jsfiddle.net/sMc8a/3/
HTML
<div class="example">
Hello
</div>
CSS
body {
background: black;
}
.example {
width: 300px;
height: 300px;
background-image: -webkit-linear-gradient(top,
rgba(0,0,0,0.9) 0%,
rgba(0,0,0,0) 20%,
rgba(0,0,0,0) 80%,
rgba(0,0,0,0.9) 100%
),
-webkit-linear-gradient(left,
rgba(0,0,0,0.9) 0%,
rgba(0,0,0,0) 20%,
rgba(0,0,0,0) 80%,
rgba(0,0,0,0.9) 100%
),
url(http://www.stadtteilschule-oejendorf.de/Unterricht/files/stacks_image_2936.png);
background-image: -moz-linear-gradient(top,
rgba(0,0,0,0.9) 0%,
rgba(0,0,0,0) 20%,
rgba(0,0,0,0) 80%,
rgba(0,0,0,0.9) 100%
),
-moz-linear-gradient(left,
rgba(0,0,0,0.9) 0%,
rgba(0,0,0,0) 20%,
rgba(0,0,0,0) 80%,
rgba(0,0,0,0.9) 100%
),
url(http://www.stadtteilschule-oejendorf.de/Unterricht/files/stacks_image_2936.png);
background-image: -o-linear-gradient(top,
rgba(0,0,0,0.9) 0%,
rgba(0,0,0,0) 20%,
rgba(0,0,0,0) 80%,
rgba(0,0,0,0.9) 100%
),
-o-linear-gradient(left,
rgba(0,0,0,0.9) 0%,
rgba(0,0,0,0) 20%,
rgba(0,0,0,0) 80%,
rgba(0,0,0,0.9) 100%
),
url(http://www.stadtteilschule-oejendorf.de/Unterricht/files/stacks_image_2936.png);
background-image: linear-gradient(top,
rgba(0,0,0,0.9) 0%,
rgba(0,0,0,0) 20%,
rgba(0,0,0,0) 80%,
rgba(0,0,0,0.9) 100%
),
linear-gradient(left,
rgba(0,0,0,0.9) 0%,
rgba(0,0,0,0) 20%,
rgba(0,0,0,0) 80%,
rgba(0,0,0,0.9) 100%
),
url(http://www.stadtteilschule-oejendorf.de/Unterricht/files/stacks_image_2936.png);
}