z-index設(shè)置無效
我設(shè)置了z-index值,但是無效,不知是怎么回事?
<!doctype html>
<html>
<head>
?? ?<meta charset="UTF-8">
?? ?<title>shadow</title>
?? ?<style>
?? ??? ?.shadow{
?? ??? ??? ?width:500px;
?? ??? ??? ?height:300px;
?? ??? ??? ?margin:100px auto;
?? ??? ??? ?box-shadow: 0 1px 5px rgba(0, 0, 0, .5);
?? ??? ??? ?position: relative;
?? ??? ?}
?? ??? ?.shadow:after{
?? ??? ??? ?content:'';
?? ??? ??? ?position: absolute;
?? ??? ??? ?top:50%;
?? ??? ??? ?left:12px;
?? ??? ??? ?right:12px;
?? ??? ??? ?bottom: 0;
?? ??? ??? ?box-shadow: 0 5px 10px rgba(0, 0, 0, .8);
?? ??? ??? ?border-radius:100px/10px;
?? ??? ??? ?z-index: -1;
?? ??? ?}
?? ?</style>
</head>
<body>
?? ?<div></div>
</body>
</html>
2015-02-18
親~你打算把這些css賦予給誰生效呢?
你的代碼:
怎么著也得這樣吧:
對于CSS設(shè)置好的類,需要告訴他賦予給誰,要不然他也不知道把誰改掉。
最常用的CSS選擇器有:類選擇器,標(biāo)簽選擇器,id選擇器
不太明白的話請自行搜索這三個(gè)詞,例如:http://blog.sina.com.cn/s/blog_5674f6d401018wz8.html
詳見CSS選擇器:http://www.w3school.com.cn/cssref/css_selectors.asp