css3之小米界面产品模块实现——学习笔记14

在这里插入图片描述
代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
    <style>
        /* 取消内外边距 */
        * {
            margin: 0;
            padding:0;
        }
        /* 将整个页面的底色换成这种浅浅的灰色 */
        body {
            background-color: #f5f5f5;
        }
        /* 设置盒子的长宽 背景色 居中 */
        .box {
            width: 298px;
            height: 415px;
            background-color: white;
            margin: 100px auto;/*这是块级元素的居中方式*/
        }
        .box img {
            width: 298px;
        }
        .review {
            font-size: 14px;
            height: 70px;
            padding:0 28px;
            margin-top: 30px;           
        }
        .appraise {
            color:#b0b0b0;
            font-size: 12px;
            padding:0 28px;
            margin-top: 20px;
        }
        .info {
          font-size: 14px;
          margin-top: 15px;
          padding: 0 28px;
      }
        .info h4{
            display: inline-block;/*设置成行内块元素 可以和99.9一行*/
            font-weight: 400;/*取消加粗*/
        }
        .info span {
            color: #ff6700;   
        }
        /* 斜杠 */
        .info em {
          font-style: normal;
          color: #ebe4e0;
          margin: 0 6px 0 15px;
      }
      /* 链接设置 */
      a {
          color: #333;
          text-decoration: none;
      }
    </style>

<body>
    <div class="box">
        <img src="image.jpg" alt="图片">
        <p class="review">快递牛,整体不错蓝牙可以说秒连。红米牛</p>
        <div class="appraise">来自于13435221的评价</div>
        <div class="info">
        <h4> <a href="#">Redmi AirDots真无线蓝...</a></h4>
        <em>|</em>
        <span> 99.9元</span>
     </div>
    </div>
</body>
</html>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是一个简单的登录界面的 HTML、CSS3 和 JS 代码实现: HTML 代码: ``` <!DOCTYPE html> <html> <head> <title>登录界面</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="container"> <h1>登录</h1> <form> <label for="username">用户名</label> <input type="text" id="username" name="username" required> <label for="password">密码</label> <input type="password" id="password" name="password" required> <button type="submit" id="login-btn">登录</button> </form> </div> <script src="script.js"></script> </body> </html> ``` CSS3 代码: ``` * { margin: 0; padding: 0; box-sizing: border-box; } body { background-color: #f2f2f2; font-family: Arial, sans-serif; } .container { width: 400px; margin: 50px auto; background-color: #fff; padding: 20px; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); } h1 { text-align: center; margin-bottom: 20px; } form { display: flex; flex-direction: column; } label { margin-bottom: 10px; } input { padding: 10px; margin-bottom: 20px; border: none; border-radius: 5px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); } button { padding: 10px; background-color: #007bff; color: #fff; border: none; border-radius: 5px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.1); cursor: pointer; transition: background-color 0.3s ease; } button:hover { background-color: #0069d9; } ``` JS 代码: ``` const form = document.querySelector('form'); const usernameInput = document.querySelector('#username'); const passwordInput = document.querySelector('#password'); const loginBtn = document.querySelector('#login-btn'); form.addEventListener('submit', (e) => { e.preventDefault(); const username = usernameInput.value.trim(); const password = passwordInput.value.trim(); if (username === '' || password === '') { alert('用户名和密码不能为空!'); } else { // 这里可以添加登录逻辑 alert(`欢迎,${username}!`); } }); ``` 希望这个简单的登录界面的代码能够帮到你!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值