晴空的code 2022-06-10 20:35 采纳率: 75%
浏览 27
已结题

初次用HTML#CSS写搜索框遇到的问题

img


初次写搜索框,当点击搜索框时,搜索颜色就变成了黑色,这是为什么?该如何解决?

img


<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="keyword" content="HTML">
    <meta name="author" content="唐增友">
    <title>搜索框</title>
    <style>
        .father {
            background-color:RGB(255, 255, 255);
            width:533px;
            height:45px;
            border-radius:34px;
            border-style: solid;
            border-color:olivedrab;
        }
        input {
            width:406px;
            height: 23px;
            margin: 8px 8px 8px 21px;
            border:0;
            color:darkgray;
        }
        button,i {
            background-color:white;
            border:none;
            font-family:"宋体",serif;
            font-size:16px;
            font-style: normal;
        }
    </style>
</head>
<body>
    <div class="father">
        <input type="text" value="搜索内容">
        <button><i>百度一下</i></button>
    </div>
</body>
</html>
  • 写回答

2条回答 默认 最新

  • Heerey525 前端领域新星创作者 2022-06-10 22:54
    关注

    这是input的默认css,被聚焦之后添加了一层边框outline
    可以设置input { outline: none; }

    <!DOCTYPE html>
    
    <html>
      <head>
        <meta name="viewport" content="width=device-width" />
        <title>Index</title>
        <style>
          input {
            outline: none;
          }
        </style>
      </head>
      <body>
        <input type="text" />
      </body>
    </html>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 6月19日
  • 已采纳回答 6月11日
  • 创建了问题 6月10日

悬赏问题

  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法