Swap out a Dropdown Menu for a text box in a flexible design layout

Is it possible to switch out a Dropdown Menu with a text box in a search form? The textbox needs to match the size of the Dropdown Menu being replaced.

Here is the code for the form:

    <form action="#">
                <input type="text" class="form-control" placeholder="Type your key word">
                <div class="dropdown category-dropdown">                        
                    <a data-toggle="dropdown" href="#"><span class="change-text">Job Location</span> <i class="fa fa-angle-down"></i></a>
                    <ul class="dropdown-menu category-change">
                        <li><a href="#">Location 1</a></li>
                        <li><a href="#">Location 2</a></li>
                        <li><a href="#">Location 3</a></li>
                    </ul>                               
                </div><!-- category-change -->
                <button type="submit" class="btn btn-primary" value="Search">Search</button>
            </form>

Regarding the style:

.category-dropdown {
  background-color: #fff;
  border-right: 1px solid #e6e6e6;
  border-radius: 5px 0px 0px 5px; 
  min-width: 200px;
  line-height: 45px;
  text-align: left;
  padding: 0 20px;
}

If you'd like to preview the template, you can access it via this link:

This may seem like a simple question, but as someone new to CSS and more familiar with backend development, any guidance would be appreciated.

Answer №1

One easy approach could be to use the following code snippet instead of

<div class="dropdown category-dropdown">
:

<input type="text" class="form-control keyword-input" placeholder="Enter your search term">

CSS Style:

.keyword-input{
  width: 25%;
  min-width: 25%;
}

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

The active link color for navigation in Bootstrap 4

I am trying to update the active menu links to display in green on my website. Despite various attempts, I have not been successful in changing the color. Can anyone provide guidance on how to proceed? My website is built with Bootstrap 4 and mdbootstrap. ...

Reset the child JSP page to its original appearance

Displayed below is a JSP page: <div id="tabs-7" style="width: 100%;"> <form:form id="deviceForm" name="" modelAttribute="" enctype="multipart/form-data"> <div class="inputWidgetContainer"> <div class="inputWidget"> <table> ...

Align dropdown navigation menu/sorting dropdown in the same position as the button

Exploring the world of dropdown menus in CSS has led me to encounter some challenges. I am striving to ensure that the dropdown boxes appear on the same line as the button that triggers them. Below is the CSS code I have been working with: /* global style ...

What is the best way to maximize the size of an image without causing the parent div to expand in height?

I have utilized the code below directly from the example provided at https://getbootstrap.com/docs/5.2/utilities/flex/#media-object. This code is meant to generate a box containing an image on the left and text on the right: <div class="mycard bord ...

The child's styling is conflicting with the parent's styling

Issue with Parent and Child Component Margins import "../src/App.css"; import CardComponent from "./components/CardComponent"; function App() { return ( <div className="App"> <div className="card"></div> <CardCompon ...

Convert text into a clickable link

Creating a form with numerous text fields, some of which require numerical input. The main goal is to have users enter a tracking number, order number, or any other type of number that, when submitted, will open a new URL in a separate window with the spec ...

What is the equivalent of a very deep selector in TailwindCSS?

When working with the v-deep selector to customize the appearance of tiptap, a rich text editor, accessing the .ProseMirror class in SCSS would look like this: editor-content { // ... styles &::v-deep(.ProseMirror) { // ... styles } } ...

What could be causing issues with the JQuery .Resize() function?

I'm attempting to create a responsive layout where the content div adjusts itself when the user resizes the page. The top and bottom divs are static, so only the content div changes its size based on the page flow. $(window).resize(function() { v ...

Apply a background image to the input[type='submit'] along with text

<input name="submit" type="submit" value="Search" class="button search"> Is it feasible to incorporate a CSS gradient using background-image: and still display the text within the value attribute? Whenever I introduce a background-image, it conceal ...

"Exploring the Power of Perl in Harnessing Html5 Server-S

I have been working on implementing server sent events to replace ajax long polling within my application. However, I have encountered an issue with my perl script where the sleep function is causing the sending stream to be blocked. #!/opt/lampp/bin/perl ...

Tips for changing color when hovering over elements in a CSS grid

I am currently attempting to incorporate a hover effect into this CSS grid, but I have not been successful in my efforts. I experimented with transition and opacity techniques, but they did not work as expected. Can someone please point out what I may be ...

Scrolling presentation with dynamic animations

Does anyone have any suggestions for creating a scrolling effect similar to the one on this website? I want to implement a scroll effect where each presentation page is revealed one by one when the user scrolls using their mouse wheel, encouraging them to ...

Revamp Your Navbar Links with Bootstrap Color Customization

Even though this topic has been discussed extensively, I still haven't found a solution that works for me. My goal is simple - to change the color of the links in my bootstrap navbar to white. I know that the CSS is correctly applied because I can adj ...

Creating responsive tabs that transition into a drop-down menu for mobile devices is a useful feature for

I am looking to create a responsive tab design that drops down like the example shown below: Desktop/Large Screen View https://i.stack.imgur.com/hiCYz.png Mobile View https://i.stack.imgur.com/gRxLv.png I have written some code for this, but I am unsure ...

Creating a modal form with jQuery in ASP.NET

I'm fairly new to ASP.NET development and have been able to work on simple tasks so far. However, I now have a more complex requirement that I'm struggling with. My goal is to create a modal form that pops up when a button is clicked in order to ...

What is the best way to achieve vertical text box scrolling in CSS and HTML overflow?

I'm having an issue with a text box I created and I couldn't find a solution elsewhere. Here is the CSS script for the text box: css: .cln{ top:220px; width:680px; height:350px; text-align:left; overflow:scroll; white-space: nowrap; overflow: ...

Switch between different stylesheets effortlessly with just one button click

I'm interested in creating a button that can switch between two stylesheets with a single click. Here is the current code I am using: <link id="style1" rel="stylesheet" type="text/css" href="style.css" /> <link id="style2" rel="stylesheet" t ...

Generating HTML content using Angular 8 and JSON data

Currently, I am managing an Angular Storybook that consists of various components. Within the stories.ts file of a component, there is a JSON snippet containing properties such as the content of a DIV element, shown below... { "accordionLink": ' ...

Using jQuery to dynamically update elements as the user scrolls

Looking to dynamically update the position of a div on a webpage as the user scrolls down? Check out this JavaScript script that utilizes a h2 HTML element to display the y-coordinate of the element. To see the script in action, visit the following jsFiddl ...

Invisible Thinglink image revealed upon resizing browser

I am currently repurposing a pre-existing theme that has a drop-down menu showcasing an image. I am attempting to integrate a Thinglink into the content section of this drop-down, but unfortunately, the image does not appear until I adjust the size of the ...