【问题标题】:Search icon not showing in HTML & CSS (Adobe Dreamweaver CC 2019)HTML 和 CSS 中未显示搜索图标 (Adobe Dreamweaver CC 2019)
【发布时间】:2018-12-17 22:42:21
【问题描述】:

我一直在处理一项小任务,但似乎无法让搜索图标出现在搜索栏中。我到处寻找答案,这真的让我很烦哈哈。我会说我是 HTML 和 css 的初学者,所以如果有任何愚蠢的错误,请理解。

<!doctype html>
<html>
<head>
<meta charset="utf-8">
    <style>
        .searchbar {display: inline-block;
            float: right;
            padding: 20px 0px}
.searchbar input[type=text] {border:none;
                         font-family: courier;
                         font-size: 18px;
                         font-style: italic;
                         }

.searchbar button {float: right;
               padding:12px;
               background: #ddd;
               font-size: 12px;
               border: none;
               cursor: pointer;
              }
</style>
<title>Untitled Document</title>
</head>
<body>
    <div class="searchbar">
        <input type="text" placeholder="search...">
        <button type="submit"><i class="fa fa-search"></i></button> 
    </div>
</body>
</html>

【问题讨论】:

  • 您需要包含 FontAwesome。

标签: html css icons font-awesome


【解决方案1】:

您正在尝试使用Font Awesome 图标。 Font Awesome 是一个通过 CSS 交付的图标字体库。因此,您需要在页面上包含 Font Awesome CSS,.fa.fa-search CSS 类才能正常工作。

.searchbar {
  display: inline-block;
  float: right;
  padding: 20px 0px
}

.searchbar input[type=text] {
  border: none;
  font-family: courier;
  font-size: 18px;
  font-style: italic;
}

.searchbar button {
  float: right;
  padding: 12px;
  background: #ddd;
  font-size: 12px;
  border: none;
  cursor: pointer;
}
<link href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" rel="stylesheet"/>

<div class="searchbar">
  <input type="text" placeholder="search...">
  <button type="submit"><i class="fa fa-search"></i></button>
</div>

【讨论】:

  • 啊废话,我刚刚编辑了他的 sn-p 以包含它。嘿@user10803421,如果这回答了你的问题,我错误地编辑了你的问题,应该恢复它。 PS,欢迎来到 SO :)
  • 10-4,谢谢。我以为他在问他的花车等,我应该多加注意。干杯
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-06
  • 2012-02-08
  • 1970-01-01
  • 1970-01-01
  • 2022-01-24
  • 2021-09-24
相关资源
最近更新 更多