前端案例(5)- search

本文主要介绍了如何在HTML中使用`<input>`标签创建搜索框,并设置了不同类型的样式,如文本类型、placeholder属性以及CSS样式,包括边框、内边距、阴影等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

搜索框就是<input>来实现

input有很多个type,有text,checkbox(点击后有✅)

如果想在搜索框没有输入文字的时候已经有提示搜索此,就是<input class="search-box" type="text" placeholder="Search">

其他border格式设置和阴影设置都和前面写的案例中设置方法一样

<!DOCTYPE html>
<html>

<head>
  <title> hello, Youtube!</title>
  <style>
    .thumbnail {
      width: 278px;
      height: 158px;
      object-fit: cover;
      object-position: left;
      border-width: 2px;
      border-color: red;
      border-style: solid;
    }

    .search-box {
      font: 24px;
      border-radius: 12px;
      border: 1px;
      border-color: darkgrey;
      cursor: pointer;
      box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.15);
      margin-left: 8px;
      padding-left: 6px;
      width: 200px;
      height: 30px;
    }
  </style>
</head>

<body>
  <img class="thumbnail" src="">
  <input type="text" class="search-box" placeholder="Search in xxx">
</body>

</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值