qq_42669510 2023-09-01 15:29 采纳率: 73.3%
浏览 7
已结题

CSS边框颜色代码问题

img

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      .box {
        width: 800px;
        height: 800px;
        border: 1px solid green;
        margin: 200px auto;
        padding: 300px;
        display: flex;
        justify-content: center;
      }
      input {
        outline: 0;
        border-color: pink;
        padding-left: 25px;
        width: 300px;
        height: 30px;
        border-right: 0;
      }
      input::placeholder {
        color: #eae;
      }
      .btn1 {
        outline: 0;
        height: 100%;
        border-left: 0;
        border-color: pink;
        background-color: #fff;
        width: 120px;
        white-space: nowrap;
      }
      .fa1 {
        height: 30px;
        display: flex;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="fa1">
        <input
          type="text"
          placeholder="短信验证码"
          class="info" />
        <button class="btn1">获取验证码</button>
      </div>
    </div>
    <script>
      /* 小兔鲜页面注册 */
      /* 需求1:发送验证码 用户点击之后,显示05秒后重新获取,时间到了,自动改为 重新获取 */
      const info = document.querySelector('.info')
      const btn1 = document.querySelector('.btn1')
      let i = 5
      btn1.addEventListener('click', () => {
        info.placeholder='已发送'
        let num = setInterval(function () {
          btn1.innerHTML = `0${i}秒后再重新获取`
          i--
          if (i === -1) {
            clearInterval(num)
            i = 5
            btn1.innerHTML = '重新获取'
            info.placeholder='短信验证码'
          }
        }, 1000)
      })
    </script>
  </body>
</html>
提问:为什么输入框和按钮的边框颜色没有完全变绿?怎么修改?

  • 写回答

4条回答 默认 最新

  • qq_42669510 2023-09-01 15:55
    关注

    改好了

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta
          name="viewport"
          content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <style>
          * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
          }
          .box {
            width: 800px;
            height: 800px;
            border: 1px solid green;
            margin: 200px auto;
            padding: 300px;
            display: flex;
            justify-content: center;
            overflow: hidden;
          }
          input {
            outline: 0;
            padding-left: 25px;
            width: 300px;
            height: 100%;
            border: 0;
          }
          input::placeholder {
            color: #eae;
          }
          .btn1 {
            outline: 0;
            height: 100%;
            border: 0;
            background-color: #fff;
            width: 120px;
            white-space: nowrap;
            cursor: pointer;
          }
          .fa1 {
            margin: 30px 0;
            height: 30px;
            width: 422px;
            display: flex;
            border: 1px solid pink;
          }
        </style>
      </head>
      <body>
        <div class="box">
          <div class="fa2"></div>
          <div class="fa1">
            <input
              type="text"
              placeholder="短信验证码"
              class="info" />
            <button class="btn1">获取验证码</button>
          </div>
        </div>
        <script>
          /* 小兔鲜页面注册 */
          /* 需求1:发送验证码 用户点击之后,显示05秒后重新获取,时间到了,自动改为 重新获取 */
          const info = document.querySelector('.info')
          const btn1 = document.querySelector('.btn1')
          infoTime()
          function infoTime() {
            let i = 5
            btn1.addEventListener('click', () => {
              btn1.disabled = true
              info.placeholder = '已发送'
              let num = setInterval(function () {
                btn1.innerHTML = `0${i}秒后再重新获取`
                i--
                if (i === -1) {
                  clearInterval(num)
                  i = 5
                  btn1.innerHTML = '重新获取'
                  info.placeholder = '短信验证码'
                  btn1.disabled = false
                }
              }, 1000)
            })
          }
          /* 需求2 用户名验证 
          2.1 封装函数 失去焦点触发函数
          2.2 正则 /^[a-zA-Z0-9-_]{6,10}$/
          2.3 不符合要求,则出现提示,并return false 中断程序 否则返回return true
          之后返回布尔值,为最后提交按钮做准备
          侦听使用change事件,当鼠标离开表单,且表单值发生变化时触发
          */
        </script>
      </body>
    </html>
    
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 9月13日
  • 已采纳回答 9月5日
  • 创建了问题 9月1日