Less教程
Less函数

Less image-height()

Less image-height()

Less image height功能用于检查文件中图像的高度。
让我们举个例子演示在Less文件中使用图像高度功能。
创建一个名为"simple.html"的HTML文件,其中包含以下数据。
HTML文件: simple .html
<!DOCTYPE html>
<head>
   <link rel="stylesheet" href="simple.css" type="text/css" />
</head>
<body>
  <h2>Welcome to lidihuo</h2>
  <h3>A solution of all technology.</h3>
</body>
</html>
现在创建一个名为"simple.less"的文件。它类似于CSS文件。唯一的区别是它以" .less"扩展名保存。
less 的文件: simple.less
body{
  background-image:url("image.jpg");
  height:image-height("image.jpg");
}
同时放入两个文件"simple.html"?和?simple.less?在Node.js的根文件夹中
现在,执行以下代码: lessc simple.less simple.css
less 图像高度function1
这将编译"simple.less"文件。一个名为" simple.css"的CSS文件。将会生成。
例如:
less image height function2
生成的CSS" simple.css"具有以下代码:
body {
  background-image: url("image.jpg");
  height: 438px;
}
输出:
less 图像高度功能3
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4