点餐APP 页面设计与代码示例 - HTML & CSS
点餐APP 页面设计与代码示例 - HTML & CSS
本项目使用 HTML 和 CSS 实现了一个精美的点餐APP页面,包括首页、登录页、注册页、详情页、闪屏页、个人中心页、启动页等。由于要实现完整的APP页面,代码片段过长,建议查看完整代码和效果请前往我的GitHub仓库:https://github.com/JiangXinxuan/Ordering-APP
以下是部分代码片段:
首页
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<link rel='stylesheet' href='css/style.css'>
<title>点餐APP首页</title>
</head>
<body>
<header>
<div class='logo'>
<img src='img/logo.png' alt='点餐APP'>
</div>
<nav>
<ul>
<li class='active'><a href='#'>首页</a></li>
<li><a href='#'>菜单</a></li>
<li><a href='#'>订单</a></li>
<li><a href='#'>个人中心</a></li>
</ul>
</nav>
</header>
<div class='banner'>
<img src='img/banner.jpg' alt='点餐APP'>
</div>
<div class='container'>
<div class='title'>
<h2>推荐菜品</h2>
<a href='#'>更多</a>
</div>
<div class='foods'>
<div class='food'>
<img src='img/food1.jpg' alt='菜品1'>
<div class='info'>
<h3>菜品1</h3>
<p>描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述</p>
<div class='price'>
<span>¥20.00</span>
<button>加入购物车</button>
</div>
</div>
</div>
<div class='food'>
<img src='img/food2.jpg' alt='菜品2'>
<div class='info'>
<h3>菜品2</h3>
<p>描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述</p>
<div class='price'>
<span>¥30.00</span>
<button>加入购物车</button>
</div>
</div>
</div>
<div class='food'>
<img src='img/food3.jpg' alt='菜品3'>
<div class='info'>
<h3>菜品3</h3>
<p>描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述</p>
<div class='price'>
<span>¥25.00</span>
<button>加入购物车</button>
</div>
</div>
</div>
</div>
</div>
<footer>
<p>©点餐APP 2021</p>
</footer>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: '微软雅黑', sans-serif;
font-size: 16px;
color: #333;
}
header {
background-color: #fff;
position: fixed;
width: 100%;
top: 0;
left: 0;
z-index: 999;
box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.logo img {
height: 50px;
margin-left: 50px;
margin-top: 10px;
}
nav {
display: inline-block;
float: right;
margin-right: 50px;
margin-top: 10px;
}
nav ul {
list-style: none;
}
nav ul li {
display: inline-block;
margin-left: 20px;
}
nav ul li a {
text-decoration: none;
color: #333;
font-size: 14px;
padding: 5px;
border-radius: 5px;
transition: all .3s ease;
}
nav ul li.active a,
nav ul li a:hover {
background-color: #333;
color: #fff;
}
.banner img {
width: 100%;
height: auto;
}
.container {
margin-top: 150px;
padding: 0 50px;
}
.title {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
}
.title h2 {
font-size: 24px;
}
.title a {
color: #333;
text-decoration: none;
font-size: 14px;
padding: 5px 10px;
border-radius: 5px;
border: 1px solid #333;
transition: all .3s ease;
}
.title a:hover {
background-color: #333;
color: #fff;
}
.foods {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.food {
width: 30%;
margin-bottom: 50px;
box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.food img {
width: 100%;
height: auto;
}
.info {
padding: 20px;
}
.info h3 {
font-size: 20px;
margin-bottom: 10px;
}
.info p {
font-size: 14px;
color: #666;
margin-bottom: 20px;
}
.price {
display: flex;
justify-content: space-between;
align-items: center;
}
.price span {
font-size: 18px;
}
.price button {
background-color: #333;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
font-size: 14px;
cursor: pointer;
transition: all .3s ease;
}
.price button:hover {
background-color: #fff;
color: #333;
border: 1px solid #333;
}
登录页
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<link rel='stylesheet' href='css/style.css'>
<title>点餐APP登录</title>
</head>
<body>
<header>
<div class='logo'>
<img src='img/logo.png' alt='点餐APP'>
</div>
</header>
<div class='container'>
<h2>登录</h2>
<form>
<div class='form-group'>
<input type='text' placeholder='手机号/邮箱'>
</div>
<div class='form-group'>
<input type='password' placeholder='密码'>
</div>
<button type='submit'>登录</button>
</form>
<div class='links'>
<a href='#'>忘记密码?</a>
<span>|</span>
<a href='#'>立即注册</a>
</div>
</div>
<footer>
<p>©点餐APP 2021</p>
</footer>
</body>
</html>
.container {
margin-top: 150px;
padding: 0 50px;
}
h2 {
font-size: 24px;
margin-bottom: 30px;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
.form-group {
width: 100%;
margin-bottom: 20px;
}
input[type='text'],
input[type='password'] {
width: 100%;
border: none;
padding: 10px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
button[type='submit'] {
background-color: #333;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
font-size: 14px;
cursor: pointer;
transition: all .3s ease;
}
button[type='submit']:hover {
background-color: #fff;
color: #333;
border: 1px solid #333;
}
.links {
display: flex;
justify-content: center;
margin-top: 20px;
}
.links a {
text-decoration: none;
color: #333;
font-size: 14px;
padding: 5px;
border-radius: 5px;
transition: all .3s ease;
}
.links a:hover {
background-color: #333;
color: #fff;
}
.links span {
margin: 0 10px;
}
注册页
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<link rel='stylesheet' href='css/style.css'>
<title>点餐APP注册</title>
</head>
<body>
<header>
<div class='logo'>
<img src='img/logo.png' alt='点餐APP'>
</div>
</header>
<div class='container'>
<h2>注册</h2>
<form>
<div class='form-group'>
<input type='text' placeholder='手机号'>
</div>
<div class='form-group'>
<input type='text' placeholder='邮箱'>
</div>
<div class='form-group'>
<input type='password' placeholder='密码'>
</div>
<div class='form-group'>
<input type='password' placeholder='确认密码'>
</div>
<button type='submit'>注册</button>
</form>
<div class='links'>
<span>已有账号?</span>
<a href='#'>立即登录</a>
</div>
</div>
<footer>
<p>©点餐APP 2021</p>
</footer>
</body>
</html>
.container {
margin-top: 150px;
padding: 0 50px;
}
h2 {
font-size: 24px;
margin-bottom: 30px;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
.form-group {
width: 100%;
margin-bottom: 20px;
}
input[type='text'],
input[type='password'] {
width: 100%;
border: none;
padding: 10px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
button[type='submit'] {
background-color: #333;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
font-size: 14px;
cursor: pointer;
transition: all .3s ease;
}
button[type='submit']:hover {
background-color: #fff;
color: #333;
border: 1px solid #333;
}
.links {
display: flex;
justify-content: center;
margin-top: 20px;
}
.links a {
text-decoration: none;
color: #333;
font-size: 14px;
padding: 5px;
border-radius: 5px;
transition: all .3s ease;
}
.links a:hover {
background-color: #333;
color: #fff;
}
.links span {
margin-right: 10px;
}
详情页
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<link rel='stylesheet' href='css/style.css'>
<title>点餐APP详情页</title>
</head>
<body>
<header>
<div class='logo'>
<img src='img/logo.png' alt='点餐APP'>
</div>
<nav>
<ul>
<li><a href='#'>首页</a></li>
<li><a href='#'>菜单</a></li>
<li><a href='#'>订单</a></li>
<li><a href='#'>个人中心</a></li>
</ul>
</nav>
</header>
<div class='banner'>
<img src='img/banner.jpg' alt='点餐APP'>
</div>
<div class='container'>
<div class='food'>
<img src='img/food1.jpg' alt='菜品1'>
<div class='info'>
<h3>菜品1</h3>
<p>描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述</p>
<div class='price'>
<span>¥20.00</span>
<button>加入购物车</button>
</div>
</div>
</div>
<footer>
<p>©点餐APP 2021</p>
</footer>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: '微软雅黑', sans-serif;
font-size: 16px;
color: #333;
}
header {
background-color: #fff;
position: fixed;
width: 100%;
top: 0;
left: 0;
z-index: 999;
box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.logo img {
height: 50px;
margin-left: 50px;
margin-top: 10px;
}
nav {
display: inline-block;
float: right;
margin-right: 50px;
margin-top: 10px;
}
nav ul {
list-style: none;
}
nav ul li {
display: inline-block;
margin-left: 20px;
}
nav ul li a {
text-decoration: none;
color: #333;
font-size: 14px;
padding: 5px;
border-radius: 5px;
transition: all .3s ease;
}
nav ul li.active a,
nav ul li a:hover {
background-color: #333;
color: #fff;
}
.banner img {
width: 100%;
height: auto;
}
.container {
margin-top: 150px;
padding: 0 50px;
}
.food {
width: 100%;
box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.food img {
width: 100%;
height: auto;
}
.info {
padding: 20px;
}
.info h3 {
font-size: 20px;
margin-bottom: 10px;
}
.info p {
font-size: 14px;
color: #666;
margin-bottom: 20px;
}
.price {
display: flex;
justify-content: space-between;
align-items: center;
}
.price span {
font-size: 18px;
}
.price button {
background-color: #333;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
font-size: 14px;
cursor: pointer;
transition: all .3s ease;
}
.price button:hover {
background-color: #fff;
color: #333;
border: 1px solid #333;
}
总结
本项目实现了点餐APP的基本页面框架,并提供了部分代码片段。完整的代码和功能实现请查看 GitHub 仓库。
希望本项目能够帮助你学习使用 HTML 和 CSS 进行网页设计,并为你的APP开发提供参考。
原文地址: https://www.cveoy.top/t/topic/onYQ 著作权归作者所有。请勿转载和采集!