快捷导航

请问这里的li标签设置height:100%,width:100%是相对什么而言的,不太理解

慕课七夕主题</script>*{padding:0;margin:0;}ul,li{list-style-type:none;}/*主体部分*/#content{width:60%;height:60%;top:20%;left:20%;overflow:hidden;position:absolute;border:1pxsolid#ccc;}.content-wrap{position:relative;}.content-wrap>li{width:100%;height:100%;background:#CAE1FF;color:red;float:left;overflow:hidden;position:relative;}li:nth-child(2){background:#9BCD9B;}li:nth-child(3){background:yellow;}页面1
页面2
页面3
</ul>varcontainer=$("#content");//获取第一个子节点varelement=container.find(":first");//li页面数量varslides=element.find("li");//获取容器尺寸varwidth=container.width();varheight=container.height();//设置li页面总宽度element.css({width:(slides.length*width)+'px',height:height+'px'});//设置每一个页面li的宽度$.each(slides,function(index){varslide=slides.eq(index);//获取到每一个li元素//?});</script>

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

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

回复

使用道具 举报

参与会员2

相对于父元素,这里是div class=content-wrap宽度和高度而言。
回复

使用道具 举报

相当于包裹它的父元素,父元素如果没有定义宽高,就在网父元素的父元素找
回复

使用道具 举报

可能感兴趣的问答

发新帖
  • 微信访问
  • 手机APP