I'm looking to incorporate an "icon font" into my search bar using only CSS to activate the search functionality. Can you assist me with this task?

I've been attempting to implement a search icon that opens up a search bar. I'm almost there, but when the search icon is clicked, the search input doesn't open. However, if you click just to the right of the icon, it does. Is there a way to achieve this functionality without relying on a background image? I prefer to use icon fonts.

You can view an example here:

Answer №1

<input id="searchbar" class="t-box" type="text" value="Search Here" name="query">

<style>
    .t-box {
    background-color: #FFFFFF;
    background-image: url("../images/search_icon.png");
    background-position: 96% center;
    background-repeat: no-repeat;
    border: 1px solid #DFDFDF;
    border-radius: 10px 10px 10px 10px;
    color: #666666;
    float: right;
    font-family: Arial,Helvetica,sans-serif;
    font-size: 12px;
    height: 21px;
    margin-top: 4px;
    padding: 2px 35px 2px 7px;
    text-align: left;
    width: 1px;
}
.t-box:hover {
    width: 100px;
}
</style>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to connect Bootstrap 4 and its scripts on a webpage?

After reading this particular blog post (specifically for BS3), it suggests adding the following lines to the angular.cli.json file. ... "scripts": [ "../node_modules/jquery/dist/jquery.min.js", "../node_modules/bootstrap/dist/js/bootstrap.min.js" ], ...

Looking to update the page title on a WordPress website

I would like to update the title of a page that has been created using a category link. Specifically, I need to change the page title to "News." Although I have explored customization options, I am unable to directly modify the text. Thus, I am looking f ...

How can I turn off Mobile detection (JavaScript) when requested by the user?

I am facing an issue with a php "header" file containing Javascript for mobile detection. This script redirects users to the mobile site when necessary, preventing them from viewing the full site. How can I disable this script upon the user's request, ...

When using Phonegap in conjunction with AngularJS ng-view, the full-screen mode cannot be

I have seen similar questions asked before, but none of the solutions I found have worked for me so far. Here are some key parts of my index.html file: <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, ...

How can I display two slides at once in Ionic 2/3 on a wide screen?

I have been searching for a solution that will allow me to display 1 ion-slide if the device screen is small, but if it's larger, then I want to display 2 ion-slides. Unfortunately, I have not been able to find a suitable solution yet. As an example, ...

Is your URL getting cut off in jQuery?

How can I properly display a URL in an HTML table without it getting truncated? I'm attempting to show it within a table using jQuery, but it seems to be cutting off the URL. Here's a snippet of my code. Any suggestions on how to fix this? <! ...

"Implementing angularJS html5mode within a controller: A step-by-step guide

Recently, I have been trying to familiarize myself with AngularJS. I'm attempting to set the html5 mode to true in a specific controller within my AngularJS application which consists of three controllers. Despite my efforts to configure the setting u ...

Using AJAX and Rails to set session variables in the presence of appcache

When making an ajax call to "updateUser," the following code is executed: puts session[:user_id] user = User.find(params[:user_id]) if user session[:user_id] = user.id session[:user_name] = user.first_name + " " + user.last_name puts session[:user_i ...

What is the appropriate HTML tag to use for content that has been modified (without being added or removed)?

When it comes to identifying added and deleted content, I am familiar with using <ins> for added content and <del> for deleted content. However, what tag should be used to mark content that has changed without specifying what exactly was added ...

Show Data on the Right-hand Side

Objective: Arrange the component names in two columns - left and right, with different objects like input textboxes based on a browser width of 981px. The desired layout is showcased in this link "https://jsfiddle.net/2w9kskr2/". Challenge: After impl ...

Applying CSS styles to a page depending on certain conditions

Currently, I have a page in SharePoint that can function as a pop-up. I am using JavaScript to identify whether it is a pop-up by checking if window.location.search.match("[?&]IsDlg=1"). However, I am struggling to figure out how to insert CSS based on ...

Django - issue with table display showing empty row due to query set

In my project, I have two models: one named Season and the other one named Game: # Season class Season(models.Model): teams = models.ManyToManyField('Team', related_name='season_teams', blank=True) current = models.BooleanF ...

Ways to personalize an image within a table cell using HTML

I need some advice on adjusting the size of an image that I have inserted into a cell of a table on my html page. Can someone please guide me on how to do this? Thank you! ...

Expanding rows in Angular UI-Grid: Enhancing user experience with hover functionality

Struggling to add a hover effect to the rows in an Angular UI grid. The goal is for the entire row to change background color when hovered over, but with an expandable grid that includes a row header, applying CSS rules only affects either the row header o ...

Whenever I include __MSG_@@extension_id__ in my CSS file, I am encountering chrome://invalid

Currently, I am in the process of developing a chrome extension using Manifest V3. In my CSS file, I have incorporated the following code snippet to load local fonts. @font-face { font-family: 'PoppinsLight'; src: url('chrome-extensi ...

Adjust the width of the table border without affecting the positioning of any other elements

I designed a table with buttons that, when clicked, increase their border width from 1px to 3px. Despite browsing through resources like Javascript - Changing border-width without moving surrounding elements., Don't affect positioning of other element ...

Scroll through the div to quickly find the relevant content

I have implemented the following HTML structure: <div style="height:200px;overflow-y:scroll;"> <table>.....</table> </div> By using this setup, I am aiming to replicate the functionality of an expanded <select> control wit ...

Recreating dropdown menus using jQuery Clone

Hey there, I'm facing a situation with a dropdown list. When I choose "cat1" option, it should display sub cat 1 options. However, if I add another category, it should only show cat1 options without the sub cat options. The issue is that both cat 1 a ...

Having trouble changing the color of the active icon in Material UI stepper

I am running into an issue with changing the color of the highlight class when using react material ui. https://i.sstatic.net/1lxTs.png CSS stepIcon: { '&$active': { color: '#1e88e5', }, }, < ...

Styling for a <h:panelGrid using CSS

JSF / CSS / Trinidad Note - these three are part of a delivery from IBM ILog and cannot be changed JSF 1.2-1.2_07-b03-FCS JSTL 1_1-mr2 (special build) Trinidad 1.2.8 Java 1.6.0_22-b04 Eclipse 3.6.0 (Helios) Tomcat 6.0.28 (needs to run also on Weblog ...