Stylish Search Box Html

In this post i am going to share Stylish Search Box Html code. you can use this code in your website to Make More Attractive.

Stylish Search Box Html

Stylish Search Box Html

<link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
    />

<body>
    <div class="hero">
      <div id="searchBox">
        <i class="fab fa-google fa-3x" id="googleIcon"></i>
        <input type="text" placeholder="Search Google or type URL" />
        <i class="fas fa-microphone fa-3x "></i>
      </div>
    </div>

    <script src="script.js"></script>
  </body>

Stylish Search Box CSS

@import url('https://fonts.googleapis.com/css2?family=Varela+Round&display=swap');

* {
  margin: 0;
  padding: 0;
  font-family: 'Varela Round', sans-serif;
}

.hero {
  width: 100%;
  height: 100vh;
  background: #f0f3ff;
  display: flex;
  align-items: center;
  justify-content: center;
}

#searchBox {
  border-radius: 55px;
  padding: 30px;
  background: #f0f3ff;
  display: flex;
  align-items: center;
  box-shadow: 6px 6px 10px -1px rgba(0, 0, 0, 0.15),
    -6px -6px 10px -1px rgba(255, 255, 255, 0.7);
}

#googleIcon {
  width: 50px;
  cursor: pointer;
}

.fa-microphone {
  // width: 0px;
  transition: 0.5s;
  transition-delay: 0.5s;
}

input {
  font-size: 20px;
  width: 0px;
  border: 0;
  background: transparent;
  outline: none;
  transition: 2s;
}

.active input {
  width: 500px;
  padding: 12px 20px;
}

.active .mic-icon {
  width: 30px;
}

Stylish Search Box JS

const searchBox = document.getElementById('searchBox'),
  googleIcon = document.getElementById('googleIcon');

googleIcon.onclick = function () {
  searchBox.classList.toggle('active');
};

Also Check

Leave a Reply

Your email address will not be published.