微信授权页面移动端用less编写+html
时间: 2024-01-14 08:03:45 浏览: 30
下面是一个完整的微信授权页面的示例,使用 Less 和 HTML 编写:
HTML 代码:
```
<!DOCTYPE html>
<html>
<head>
<title>微信授权页面</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet/less" type="text/css" href="style.less">
<script src="https://cdn.bootcdn.net/ajax/libs/less.js/3.12.2/less.min.js"></script>
</head>
<body>
<div class="container">
<h1 class="title">微信授权页面</h1>
<form class="form">
<input type="text" class="input" placeholder="请输入微信号或手机号">
<input type="password" class="input" placeholder="请输入密码">
<button class="button">登录</button>
</form>
</div>
</body>
</html>
```
Less 代码:
```
@primary-color: #07c160;
@font-size: 14px;
@border-radius: 4px;
.container {
padding: 20px;
background-color: #f8f8f8;
.title {
font-size: 18px;
color: @primary-color;
margin-bottom: 10px;
}
.form {
background-color: #fff;
border-radius: @border-radius;
padding: 20px;
.input {
border: none;
border-bottom: 1px solid #ddd;
height: 40px;
line-height: 40px;
font-size: @font-size;
width: 100%;
margin-bottom: 10px;
&:last-child {
margin-bottom: 20px;
}
}
.button {
background-color: @primary-color;
color: #fff;
border-radius: @border-radius;
height: 40px;
line-height: 40px;
text-align: center;
font-size: @font-size;
}
}
}
```
编译后的 CSS 代码:
```
.container {
padding: 20px;
background-color: #f8f8f8;
}
.container .title {
font-size: 18px;
color: #07c160;
margin-bottom: 10px;
}
.container .form {
background-color: #fff;
border-radius: 4px;
padding: 20px;
}
.container .form .input {
border: none;
border-bottom: 1px solid #ddd;
height: 40px;
line-height: 40px;
font-size: 14px;
width: 100%;
margin-bottom: 10px;
}
.container .form .input:last-child {
margin-bottom: 20px;
}
.container .form .button {
background-color: #07c160;
color: #fff;
border-radius: 4px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 14px;
}
```
可以看到,使用 Less 和 HTML 编写微信授权页面,可以让代码更加简洁易懂,提高开发效率。