gpt4 book ai didi

html - 如何将图像添加到输入表单的右侧并使其用作搜索按钮

转载 作者:行者123 更新时间:2023-11-27 23:18:13 25 4
gpt4 key购买 nike

我一直在尝试从 bootstrap 网站编辑一个导航栏,并想制作一个带有外部图像按钮的服装输入表单,我试过弄乱 css 但我正在做笔记的代码与这个不同,它没有用。

<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<title>Hello, world!</title>
</head>
<body>
<!-- NAVBAR -->
<div>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Post layout</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" >Pages</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Shortcodes</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
<div class="search-bar">
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><img src="\searchicon.png"></button>
</form>
</div>
</div>
</nav>
</div>
<!-- /NAVBAR -->


<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

最佳答案

你可以做类似的事情

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
.parent{
position: realtive;
}
.image {
position: absolute;
top: 10px;
left: 100px;
}
.input-box {
height : 20px;
}
</style>
</head>
<body>
<div class="parent">
<input class="input-box">
<button class="image"><img src="avatar.png" alt="Avatar" style="width:15px"></button>
</div>
</body>
</html>

关于html - 如何将图像添加到输入表单的右侧并使其用作搜索按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58157350/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com