less初步接触

简介: 以前一直听说less/sass,今天我开始学习less  @font-color:#333333;//字体颜色@font-size:1.

以前一直听说less/sass,今天我开始学习less

 

 

@font-color:#333333;//字体颜色
@font-size:1.6rem;//默认字体大小
@background-colorE:#eeeeee;//背景色为#eeeeee
@overFlowHidden:hidden;//
@left:left;//左
@right:right;//右
@center:center;//中
@top1:1rem;//上边1rem
@bottom1:1rem;//下边1rem
@left1:1rem;//左边1rem
@right1:1rem;//右边1rem
/*******
*计算rem
********/
@media screen and (max-width: 1366px){
  html{
    font-size: 7px;
  }
  body{
    font-size: 7px;
  }
}
@media (min-width: 1367px) and (max-width:1600px ){
  html{
    font-size: 8px;
  }
  body{
    font-size: 8px;
  }
}
@media screen and (min-width:1601px ){
  html{
    font-size: 10px;
  }
  body{
    font-size: 10px;
  }
}

/**
计算边框(类似于js中的函数)
**/
.borderLeft(@style:solid,@width:0.1rem,@color:#efefef){/*样式,宽度,颜色*/
  border-left-color: @color;
  border-left-width: @width;
  border-left-style: @style;
}
.borderRight(@style:solid,@width:0.1rem,@color:#efefef){/*样式,宽度,颜色*/
  border-right-color: @color;
  border-right-width: @width;
  border-right-style: @style;
}
.borderTop(@style:solid,@width:0.1rem,@color:#efefef){/*样式,宽度,颜色*/
  border-top-color: @color;
  border-top-width: @width;
  border-top-style: @style;
}
.borderBottom(@style:solid,@width:0.1rem,@color:#efefef){/*样式,宽度,颜色*/
  border-bottom-color: @color;
  border-bottom-width: @width;
  border-bottom-style: @style;
}

/**
计算宽度或高度
**/
.width(@width:100%){
  width: @width;
}
.height(@height:2rem){
  height: @height;
}



body{
  width: 100vw;
  height: 100vh;

  background-color: @background-colorE;
  overflow: @overFlowHidden;
}
.App{
  font-size: @font-size;
  color: @font-color;
  width: 80vw;
  margin-left: 10vw;
}
.alignCenter{
  text-align: @center;
}
.alignLeft{
  text-align: @left;
}
.alignRight{
  text-align: @right;
}
.App{
  .test{
    font-size: 3rem;
    background-color: @background-colorE;
    .width(70%);//类似函数的调用
    .height(10rem);
    .borderBottom(solid,0.1rem,#dddddd)
  }
}
相关文章
|
9天前
|
JavaScript API iOS开发
DeepSeek Harness下载、安装、配置一篇搞定(2026整理,送常用插件)
DeepSeek Harness(DSH)是DeepSeek于2026年开源的MIT协议AI Agent框架,支持插件化组装模型、工具、沙箱与UI,兼容主流大模型。本文提供免Node.js的桌面端安装包(Win/macOS),含详细图文教程及热门插件推荐。
3832 38
|
9天前
|
Linux 开发工具 iOS开发
Codex保姆级教程(下载+安装+登录+使用,含所有版本,2026最新)
Codex是OpenAI推出的开源AI编程智能体,本地运行,可理解整个代码库,支持自然语言指令改代码、执行命令、跑测试、修Bug,兼容Win/macOS/Linux。(239字)
3489 13
|
4天前
|
云安全 人工智能 安全
|
9天前
|
iOS开发 Docker MacOS
【2026实测】Docker Desktop下载、安装、汉化、配置教程(附官网安装包)
Docker Desktop 是 Docker 官方推出的桌面容器管理工具,集成引擎、CLI、图形界面与 Kubernetes,支持 Win/macOS/Linux。2026 最新版 4.88.1 强化 ARM 原生运行、镜像加速及资源可视化,附中文汉化与国内镜像配置指南。
1753 6
|
10天前
|
安全 算法 定位技术
《高性价比人生指南》完整原版:普通人用最少的资源,过好这一生的底层逻辑~How To Live Better
📖《高性价比人生指南》是一份基于实证、拒绝焦虑的生存手册,倡导以“人生时薪”为视角,重新计算时间、金钱与精力的成本与收益。它不承诺逆袭,只教人算清账:省下的钱若耗掉时间便亏;买体验比买物品更值;睡眠是最高杠杆的健康投资;关系贵在情绪价值而非表面热络;学习重在改变行为而非自我安慰。核心理念:用低成本、高回报的微小行动,换取长期的选择权——不是成为谁,而是掌控自己人生的主动权。
2061 4
|
云安全 安全 网络安全
|
3天前
|
Linux 开发工具 iOS开发
2026最新codex下载安装保姆级使用教程(下载+安装+登录+使用,含所有历史版本)
本文详解OpenAI Codex国内快速上手指南:提供Win/macOS/Linux全平台免安装包、npm/Homebrew等多方式安装、账号/API Key双登录、简体中文切换,覆盖下载、安装、汉化、使用及高频避坑(如微软商店失败、npm超时等),10分钟即可跑通。
657 0
|
22天前
|
人工智能 API 开发工具
DeepSeek Harness 神插件:白嫖 13 家大厂模型
`dsh-our-free-model` 是 DeepSeek Harness 神级插件:零配置、零API Key、零账号,聚合13家大厂免费模型(含DeepSeek V4.1 Flash、Kimi K3等),支持本地网关、用量看板与自动降级,真正实现“白嫖即用”。
4004 56