• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

谁知道[class^="small"]:nth-child(1)这种属性加伪类选择器为什么不生

html
                       
                       
                       
                       
                       
                       
               
css
html,                        body {                                width: 100%;                                height: 100%;                                margin: 0px;                                padding: 0px;                        }                                                .bg {                                background-color: coral;                                width: 100%;                                height: 100%;                                background-image: url(img/001.png);                                background-size: 100% 100%;                                position: relative;                        }                                                [class^="small"] {                                width: 166px;                                height: 111px;                                float: left;                                margin-left: 30px;                                margin-top: 40px;                        }                                                [class^="small"]:nth-child(1) {                                background-image: url(img/1.png);                        }                                                [class^="small"]:nth-child(2) {                                background-image: url(img/2.png);                        }                                                [class^="small"]:nth-child(3) {                                background-image: url(img/3.png);                        }                                                [class^="big"] {                                width: 919px;                                height: 614px;                                /*border: 1px solid #ddd;*/                                position: absolute;                                background-size: 100% 100%;                                right: 30px;                                top: 50px;                                display: none;                        }                                                [class^="big"]:nth-child(1) {                                background: url(img/11.png);                        }                                                .big2 {                                background: url(img/22.png);                        }                                                .big3 {                                background: url(img/33.png);                        }js
$(document).ready(function() {                                $(".small1").bind("click", function() {                                        $('[class^="big"]').hide()                                        $(".big1").fadeIn()                                })                                $(".small2").bind("click", function() {                                        $('[class^="big"]').hide()                                        $(".big2").fadeIn()                                })                                $(".small3").bind("click", function() {                                        $('[class^="big"]').hide()                                        $(".big3").fadeIn()                                })                        })

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与3

你在方括号前面加一个div就行了,被jQuery影响了就是这样

使用道具 举报

nth-child是选择该元素下第n个子元素,不是jQuery的eq功能

使用道具 举报

[class^="big"]:nth-child(1){
background:url(img/11.png);
}
这一行不生效,其他的都有用,难道我写错了么?

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!