Java Web实验一:商城注册页面

打印 上一主题 下一主题

主题 559|帖子 559|积分 1677

实验一   商城注册页面实现

一、实验目标
1、熟悉HTML标签和CSS的基础利用,能设计实现基本的网页页面;
2、熟悉Bootstrap框架利用。
二、实验内容
实现如下图所示的商城注册页面,页面重要分为三个部门,第一部门为导航内容,包括首页、商品分类、热销、新品、注册、登录、搜索和购物车;第二部门为注册内容,包括标题、注册表单、提交按钮等;第三部门为友情链接与作者署名,要求署名为自己的学号姓名,比方,202230901张三。(注:页面出现结果可自由发挥,包含上述三部门即可)


三、实验源代码、运行截图
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <title>商城注册页面</title>
  7.     <style>
  8.         body {
  9.             font-family: 'Arial', sans-serif;
  10.             margin: 0;
  11.             padding: 0;
  12.             background-color: #f4f4f4;
  13.         }
  14.         header {
  15.             background-color: #1c0d00;
  16.             color: #fff;
  17.             padding: 10px ;
  18.             display: flex;
  19.             justify-content: space-between;
  20.             align-items: center;
  21.         }
  22.         header nav ul {
  23.             list-style-type: none;
  24.             margin: 0;
  25.             padding: 0;
  26.             display: flex;
  27.         }
  28.         header nav ul li {
  29.             margin-right:40px;
  30.         }
  31.         header nav ul li a {
  32.             color: #fff;
  33.             text-decoration: none;
  34.             display:block;
  35.             padding:10px;
  36.         }
  37.         header nav ul li:hover {
  38.             background-color: #dc8407;
  39.         }
  40.         /* 商品分类样式 */
  41.     header nav ul li.dropdown {
  42.         position: relative;
  43.         display: inline-block;
  44.     }
  45.     header nav ul li.dropdown > a {
  46.         position: relative;
  47.         display: inline-block;
  48.     }
  49.     header nav ul li.dropdown > a:after {
  50.         content: "\25BC"; /* 下拉箭头 */
  51.         font-size: 0.8em;
  52.         color: #fff;
  53.         float: right;
  54.         margin-left: 10px;
  55.     }
  56.     header nav ul li.dropdown ul {
  57.         display: none;
  58.         color: #fff;
  59.         position: absolute;
  60.         min-width: 160px;
  61.         z-index: 1;
  62.     }
  63.     header nav ul li.dropdown ul li {
  64.         background-color:#000000;
  65.         clear: both;
  66.         color: #000000;
  67.         width: 50%;
  68.     }
  69.     header nav ul li.dropdown:hover ul {
  70.         display: block;
  71.         color: #000000;
  72.     }
  73.    .search-icon {
  74.          /* 设置图标的大小 */
  75.         font-size: 2em; /* 使用em单位可以根据父元素的字体大小进行缩放 */
  76.         /* 设置图标的颜色 */
  77.         color: #fff; /* 白色,你可以根据需要更改颜色 */
  78.         /* 添加其他样式,如边距、填充、光标样式等 */
  79.         cursor: pointer; /* 当鼠标悬停在图标上时更改光标样式 */
  80.         margin-right:-700px;
  81.    }
  82.     .shopping-cart-icon {
  83.         cursor: pointer; /* 当鼠标悬停在购物车上时更改光标样式 */
  84.         font-size:2em;
  85.         color:#fff;
  86.         margin-right:20px;
  87.     }
  88.     section {
  89.             padding: 20px;
  90.             background-color: #fff;
  91.             margin-top: 20px;
  92.             border-radius: 5px;
  93.             box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  94.             text-align: center;
  95.     }
  96.     .form-container {
  97.         text-align: center; /* 让表单内的元素居中对齐 */
  98.     }
  99.     .form-group {
  100.         /* 为每个表单组添加一些底部间距 */
  101.     }
  102.     section h2 {
  103.             text-align: center;
  104.             margin-top:-20px;
  105.             color: #dc8407;
  106.     }
  107.     section form label {
  108.             text-align: left;
  109.             margin-left: 350px;
  110.             display: block;
  111.             margin-bottom: 1px;
  112.     }
  113.     section form label1 {
  114.             text-align: left;
  115.             margin-left: 350px;
  116.             display: block;
  117.             margin-bottom: 1px;
  118.     }
  119.      section form label:after {
  120.             content: "*";
  121.             color: red;
  122.             margin-left: 5px;
  123.      }
  124.      section form label1:after {
  125.             margin-left: 5px;
  126.      }
  127.      section form input[type="text"],
  128.      section form input[type="email"],
  129.      section form input[type="people"],
  130.      section form input[type="phone"],
  131.      section form input[type="address"],
  132.      section form input[type="password"] {
  133.             width: 50%;
  134.             padding: 10px;
  135.             border: 1px solid #ccc;
  136.             border-radius: 4px;
  137.             margin-bottom: 15px;
  138.      }
  139.      section form input[type="submit"] {
  140.             padding: 10px 20px;
  141.             background-color: #dc8407;
  142.             color: #fff;
  143.             border: none;
  144.             border-radius: 4px;
  145.             cursor: pointer;
  146.      }
  147.      section form input[type="submit"]:hover {
  148.             background-color: #45a049;
  149.      }
  150.      footer {
  151.             background-color: #d4d3d2;
  152.             color: #000;
  153.             text-align: center;
  154.             padding: 10px 0;
  155.             position: fixed;
  156.             bottom: 0;
  157.             width: 100%;
  158.      }
  159.      footer a {
  160.             color: #000;
  161.             text-decoration: none;
  162.             margin: 0 5px;
  163.      }
  164.      header nav ul {
  165.         transform: translateX(50px); /* 这会将ul元素向右移动50像素 */
  166.         header nav ul li {
  167.              position: relative;
  168.              margin-right: 500px; /* 增加列表项之间的间距 */
  169.         }
  170.     }
  171.     </style>
  172. </head>
  173. <body>
  174. <header>
  175.     <nav>
  176.         <ul>
  177.             <li><a href="#">首页</a></li>
  178.             <li class="dropdown"> <!-- 给“商品分类”的li标签添加dropdown类 -->
  179.                 <a href="#">商品分类</a>
  180.                 <ul>
  181.                     <li><a href="#">分类1</a></li>
  182.                     <li><a href="#">分类2</a></li>
  183.                     <li><a href="#">分类3</a></li>
  184.                     <!-- 可以继续添加更多分类 -->
  185.                 </ul>
  186.             </li>
  187.             <li><a href="#">热销</a></li>
  188.             <li><a href="#">新品</a></li>
  189.             <li><a href="#">注册</a></li>
  190.             <li><a href="#">登录</a></li>
  191.         </ul>
  192.     </nav>
  193.     <div class="search-icon">
  194.         <i class="fas fa-search"></i>
  195.     </div>
  196.     <div class="shopping-cart-icon">
  197.         <i class="fas fa-shopping-cart"></i>
  198.         <!-- 可以在这里添加购物车中的物品数量或其他信息 -->
  199.     </div>
  200. </header>
  201. <section>
  202.     <h2>注册新用户</h2>
  203.     <form action="/register" method="post" class="form-container">
  204.         <div class="form-group">
  205.             <label for="username">用户名</label>
  206.             <input type="text" id="username" name="username" placeholder="请输入用户名"  required>
  207.         </div>
  208.         <div class="form-group">
  209.             <label for="email">邮箱</label>
  210.             <input type="email" id="email" name="email" placeholder="请输入邮箱" required>
  211.         </div>
  212.         <div class="form-group">
  213.             <label for="password">密码</label>
  214.             <input type="password" id="password" name="password"  placeholder="请输入密码" required>
  215.         </div>
  216.         <div class="form-group">
  217.             <label1 for="receiver">收货人</label1>
  218.             <input type="text" id="receiver" name="receiver" placeholder="请输入收货人" required>
  219.         </div>
  220.         <div class="form-group">
  221.             <label1 for="phone">收货电话</label1>
  222.             <input type="text" id="phone" name="phone" placeholder="请输入收货电话"required>
  223.         </div>
  224.         <div class="form-group">
  225.             <label1 for="address">收货地址</label1>
  226.             <input type="text" id="address" name="address" placeholder="请输入收货地址"required>
  227.         </div>
  228.         <input type="submit" value="提交" style="margin-top: 10px;"> <!-- 添加了内联样式来添加一些顶部间距 -->
  229.     </form>
  230. </section> <footer> <p>友情链接 https://blog.csdn.net/jianguosongzi?spm=1000.2115.3001.5343</p> <a href="#">作者署名 xxx</a>  </footer> </body> </html>
复制代码



免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

星球的眼睛

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表