您当前的位置: 首页 > 

暂无认证

  • 2浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

LESS第六课(内置函数 层级结构 继承()注意是extend,不是extends)

发布时间:2020-07-23 00:17:34 ,浏览量:2

/* 由于less的底层就是用JavaScript实现的, 所以JavaScript中常用的一些函数在less中都支持 */ 不想介绍,因为太他妈多了。。。。 你们自己看把.

"en">"UTF-8">11-less中的内置函数"stylesheet" href="css/11-less中的内置函数.css">
		

//层级结构

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> /*在哪里加&,代表了它以及上级都不是后代,其他的是哈,举例:*/ /*后代有空格才是后代哈*/ /*.father
		{
			width: 300px;
			height: 300px;
			background: red;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%,-50%);
			.son
			{
				&:hover{
			      background: skyblue;
			    }
			    width: 200px;
			    height: 200px;
			    background: blue;
			    position: absolute;
			    top: 50%;
			    left: 50%;
			    transform: translate(-50%, -50%);
			}
			&::before{
			    content: "子元素";
			    display: block;
			    background: yellowgreen;
			    width: 100px;
			    height: 100px;
  			}
		}*/ //编译后的 /*.father {
  width: 300px;
  height: 300px;
  background: red;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.father .son {
  width: 200px;
  height: 200px;
  background: blue;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.father .son:hover {
  background: skyblue;
}
.father::before {
  content: "子元素";
  display: block;
  background: yellowgreen;
  width: 100px;
  height: 100px;
}*/ /*.father
		{
			width: 300px;
			height: 300px;
			background: red;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%,-50%);
			.son
			{
				:hover{
			      background: skyblue;
			    }
			    width: 200px;
			    height: 200px;
			    background: blue;
			    position: absolute;
			    top: 50%;
			    left: 50%;
			    transform: translate(-50%, -50%);
			}
			::before{
			    content: "子元素";
			    display: block;
			    background: yellowgreen;
			    width: 100px;
			    height: 100px;
  			}
		}*/ //编译后的后代选择器 /*	.father {
  width: 300px;
  height: 300px;
  background: red;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.father .son {
  width: 200px;
  height: 200px;
  background: blue;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.father .son :hover {
  background: skyblue;
}
.father ::before {
  content: "子元素";
  display: block;
  background: yellowgreen;
  width: 100px;
  height: 100px;
}
*/ </style> </head> <body> <div></div> </body> </html> 

继承:

"en">"UTF-8">Document
		
"father">
"son">

在这里插入图片描述

关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.0491s