I am creating a Google-like search box for an e-commerce site. However, the border-color, transition and:focus properties are not working. I will specify the problem in 3 parts-
border-color: The hex color which I specified is replicated only in the bottom half of the input box, the upper half uses the default color
:focus: I want the input box to turn a shade of green, but it just turns its default color
transition: I wanted a 1s delay when it changes its color on focus, but no delay happens
I tried adding !important
to all properties just in case they conflicted with Bootstrap (I am using Bootstrap, mostly for its grid system). Yet, it still didn’t work. Here’s the code-
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Poppins' rel='stylesheet'>
<style>
input {
border-radius: 3rem;
height: 5rem;
border-color: #999999;
font-family: "Poppins";
font-size: 1.5rem;
transition: border-color 1s;
}
input[type=text]:focus {
border-color: #85de46;
}
</style>
</head>
<body>
<div class="container-fluid no-gutters">
<div class="row d-flex min-vh-100 align-items-center justify-content-center">
<input class="col-sm-10 col-md-5" placeholder="Example text">
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
</body>
</html>