且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

less嵌套

更新时间:2022-10-04 20:35:16

示例

#header{
	h1{
		font-size:26px;
		font-weight:bold;
	}
	.menu{
		width:200px;
		height:200px;
		ul>li{
			list-style:none;
		}
	}
}


说明

#header表示一个ID

h1{
		font-size:26px;
		font-weight:bold;
	}表示#header下的h1元素
	
.menu{
		width:200px;
		height:200px;
		ul>li{
			list-style:none;
		}
	}表示#header下的class="menu"的元素
依次类推


生成的css文件(example3.css)

#header h1 {
  font-size: 26px;
  font-weight: bold;
}
#header .menu {
  width: 200px;
  height: 200px;
}
#header .menu ul > li {
  list-style: none;
}


在html使用css(less3.html)


</html>



本文转自 素颜猪 51CTO博客,原文链接:
http://blog.51cto.com/suyanzhu/1900684