SASS第九篇 @import

2020-10-28 16:04:06 浏览数 (1)

代码语言:javascript复制
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		/*@import "06";/*加后缀与不加一样,这个相当于@mixin center(){
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}*/
		/*div{
		  width: 200px;
		  height: 200px;
		  background: red;
		  @include center();
		}*/
		/*下面是css的*/
		div {
	  width: 200px;
	  height: 200px;
	  background: red;
	  position: absolute;
	  left: 50%;
	  top: 50%;
	  transform: translate(-50%, -50%);
	}
	</style>
</head>
<body>
	<div></div>
</body>
</html>

06.sass文件中,里面的代码是:

代码语言:javascript复制
@import "06";/*这个相当于@mixin center(){
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

0 人点赞