gpt4 book ai didi

html - 如何更改输入类型日期的日历图标?

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

我想知道如何在不使用 jquery 的情况下更改日历 Logo ?

我希望它看起来像图片中的样子:

this is the image

 input
{
width: 50%;
padding: 8px;
border-radius: 10px;
margin-bottom: 5%;
border: 1px solid #CCCCCC;
font-size: 13px;
}



.fecha input[type="date"]::-webkit-calendar-picker-indicator

{
color: rgba(0, 0, 0, 0);
opacity: 1;
background-image: url("./../some-folder/some-file.svg");
background-repeat: no-repeat;
background-position: 100% center;
background-size: 20px;
cursor: pointer;
}
<div class="form-row fecha">
<div class="col-12">
<input placeholder="Fecha de Inicio" type="text" onfocus=" (this.type='date')" onblur="(this.type='text')">
</div>

但是我不喜欢它的样子,它看起来不像图片。

我正在使用 bootstrap4(没有 Jquery)和 sass

最佳答案

/* Styles for wrapping the search box */

.main {
width: 50%;
margin: 50px auto;
}

/* Bootstrap 4 text input with search icon */

.has-search .form-control {
padding-left: 2.375rem;
}

.has-search .form-control-feedback {
position: absolute;
z-index: 2;
display: block;
width: 2.375rem;
height: 2.375rem;
line-height: 2.375rem;
text-align: center;
pointer-events: none;
color: #000;
}
<!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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">



<title>Hello, world!</title>
</head>
<body>
<div class="row">
<div class="col-6">
<div class="input-group">
<input type="text" class="form-control" placeholder="">
<div class="input-group-append">
<button class="btn btn-secondary" type="button">
<i class="fa fa-calendar" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
</div>

<br>
<p>Other Way using no css</p>
<!--Another way-->
<div class="row">
<div class="col-6">
<div class="input-group mb-2 mr-sm-2">
<input type="text" class="form-control" id="inlineFormInputGroupUsername2" placeholder="Username">
<div class="input-group-append">
<i class="input-group-text fa fa-calendar" aria-hidden="true"></i>

</div>

</div>
</div>
</div>




<!-- 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>

请查看上面的实现,这可能会有所帮助。

关于html - 如何更改输入类型日期的日历图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58683764/

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