Buttons aligned evenly with textbox

Trying to construct an input box with two buttons positioned on the left and right. Presenting the current iteration of my project:

The desired appearance should resemble the textbox and button layout found here:

Although I've managed to achieve a somewhat aligned look, it unfortunately becomes disorganized when viewed on another operating system or computer.

My approach has involved constant adjustment of padding and margin values, but I sense there may be a more effective method. However, my attempts at finding one through Google and Stack Overflow have been unsuccessful so far. Any guidance would be greatly appreciated. Thank you.

Update: A persistent issue I'm facing is that despite setting the "height" value identically for both the button and the input box, the button consistently appears taller than the input box.

Shown below is a snippet of code:

    .halfbutton {
   border-top: 1px solid #f0d995;
   background: #806a43;
   padding: 0px 3px 0px 3px;
   background: -webkit-gradient(linear, left top, left bottom, from(#d1ad51), to(#806a43));
   background: -moz-linear-gradient(top, #d1ad51, #806a43);
   height: 30px;
   width:25px;
   -webkit-border-radius: 8px 0 0 8px;
   -moz-border-radius: 8px 0 0 8px;
   border-radius: 8px 0 0 8px;

   text-shadow: rgba(0,0,0,.4) 0 1px 0;
   color: white;
   font-size: 14px;
   font-family: Helvetica, Arial, Sans-Serif;
   text-decoration: none;
   vertical-align: middle;
   }

And for the input box:

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">

    <input style="z-index:1999;height:30px;margin:0 -.1em 0 -.1em;border:1px solid;border-color:#a1a1a1;" size="20" type="text" name="s" id="s" value="<?php ... /> 
</form>

Answer №1

I'm not sure if I fully grasp the question.
To achieve a similar look as in your provided link, you can utilize a background image in your input form;
You have the option to create an inset input form using CSS3
within your CSS styling

#inputform{
    background-color: #f7f7f7;
    -moz-box-shadow:inset -2px 2px 10px rgba(0, 0, 0, .1);
    -webkit-box-shadow:inset -2px 2px 10px rgba(0, 0, 0, .1);
    box-shadow:inset -2px 2px 10px rgba(0, 0, 0, .1);
    ...
}

Check out the linked code in the comments section for more insight;

Answer №2

Everything looks good in terms of alignment for me right now on Chrome, but there's no border on the input field which makes it a bit confusing.

I have a suggestion though - currently, the additional search options are displayed as a dropdown to the left of the input field, and the "more" dropdown with extra choices is attached to the right of the input. This layout might not align with how most users expect search boxes to function, where typically the submit or options button is located immediately to the right of the input field. Perhaps consider moving the options button to the right, and then positioning the "more" as a separate button either to the right or below it.

Just sharing my thoughts!

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

I am experiencing issues with my button not responding when I click on the top few pixels

I've created a StackBlitz version to illustrate the issue I'm facing. It seems like the problem might be related to my CSS for buttons... Essentially, when you click on the button at the very top few pixels, it doesn't register the click an ...

I attempted to activate the hover effect on a DOM element using JavaScript, but was unsuccessful. It appears that achieving this is not possible. However, I am curious as to how Chrome is able to

I attempted to activate the hover state of a DOM element using JavaScript, but had no success. It appears that this task is not achievable in the way I initially approached it. I have heard that creating a class with a hover function and then adding or ...

Struggling to align the footer of your webpage and ensure it adjusts proportionally with the window size?

After trying several codes that have worked before, I ran into a problem when attempting to place two div side by side for the footer. No matter what code I tried, I couldn't get it centered and responsive to the user window ratio. Even after consulti ...

Discovering the quantity of pagination tabs in Selenium WebAutomation

A critical element in the table "ContentPlaceHolder1_gvChannelList" is Pagination, located at the last row. I need to determine how many pages/columns are present in this pagination table. The code driver.findElements(By.id("//*[@id='ContentPlaceHold ...

I am interested in utilizing Google Apps Script (GAS) to store images in GoogleDrive and automatically populate the corresponding URL in a

Currently, I am utilizing GoogleAppsScript to develop a form for submitting names and images. The idea is to store the submitted name and image in GoogleSpreadSheet while also storing the image in GoogleDrive along with its destination URL. The process inv ...

Eliminating duplicate data submissions with jQuery Ajax

Encountering an issue with my jQuery AJAX submission process. JavaScript: $('#myform').submit(function () { if (validateEvenInputs()) { $('#btnevent').attr('disabled', 'disabled'); function ...

The alert stubbornly refuses to close even when attempting to do so

I am encountering an issue with an alert in my Bootstrap 5 project. The alert does not close when I click on the "X" button. https://i.sstatic.net/pvCdm.png Below is the code snippet: {{#if success}} <div class="container p-4"> ...

Can cookies operate on a local server?

Similar Question: Cookies on localhost with explicit domain Here is the code snippet that I am using after the user has logged in: setcookie("user",$entered_username, time()+(60*60*5)); setcookie("password",$entered_password, time()+(60*60*5)); ...

Tips for Locating an Element by Its Attribute in JQuery

I currently have a variable that holds a list of selects, and my goal is to filter out only those with a 'dependsOn' attribute set to 'EventType'. My initial attempt below doesn't seem to work as intended and returns a count of 0: ...

Troubleshooting Bootstrap 5 Navbar Customization Problem: Vertical Display Instead of Horizontal Viewing

My current challenge involves customizing a Bootstrap 5 navbar to arrange three elements - a user avatar, a notifications panel, and a menu icon - in a horizontal layout. Despite my efforts, these elements are appearing in a vertical stack instead of horiz ...

Customize the width of dropdown menus in Bootstrap

Using a dropdown menu, I want to display options for candidates that can be chosen. Additionally, I would like an input field to filter these options; so that when text is entered, the dropdown menu adjusts accordingly. Specifically, I am looking to set th ...

Tips for stopping the loading of background images on an image slider

I am utilizing unslider to showcase an image slider on the landing page of my website. The slides are designed with background images in the CSS, and they adjust based on the media query. My concern is that I don't want all the slider images to load a ...

Assign a value to a jQuery variable from user input

Can someone assist me in setting an input field to the value of a jQuery variable? I am encountering difficulties with this task. My aim is to have equipment failure counts appear in an input textbox so that I can later write the value back to a table. Eac ...

Positioning a table within a div using HTML and CSS

I've got a working example that needs just a little tweaking: In this setup, you'll find two center-aligned tables with a list of vertical buttons below, left-aligned. The challenge is making sure the tables are equally aligned at the top inste ...

"Enhance your Vue.js application with the powerful capabilities of vue3-easy

I am currently working on a Vue.js project utilizing the "vue3-easy-data-table" library and following the style recommendations outlined on this particular webpage: Despite attempting to apply the following CSS properties: --easy-table-body-even-row-font ...

CSS vertical alignment: Getting it just right

I am currently using Bootstrap and below is a snippet of the code I have implemented. <div class="row"> <div class="col-lg-6"><img src="#" alt=""></div> <div class="col-lg-6"> <h2>Heading</h2> ...

What is the best way to display multiple HTML files using React?

Looking to develop a web application using React that consists of multiple HTML pages. For instance, login.html and index.html have been created and linked to URIs through the backend - resulting in localhost:8080/login and localhost:8080/index. However, R ...

Scrolling Text Loop with CSS Animation

I am currently working on creating a unique CSS animation that resembles a looped conveyor belt. Essentially, I want the text within a div to disappear off the screen to the right and then reappear from the left. Here's the approach I've taken s ...

Utilize Flask and Python to make data predictions on a CSV file

Hello there, Just starting out with Python and Flask API, I'm currently working on importing a CSV file and exporting another CSV file with predictions. The INPUT CSV file is structured like this experience test_score interview five ...

The Impact of Using Custom HTML Tags with AngularJS Directives

If I were to create a unique avatarDirective in AngularJS that is connected to an userEmail property on the scope. The directive would update this HTML … <avatarDirective userEmail="user.email" /> with a standard img tag that has its src attribut ...