Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6388225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:15:09+00:00 2026-05-25T03:15:09+00:00

I have two input elements inside a div (a textbox and an image), intended

  • 0

I have two input elements inside a div (a textbox and an image), intended to look like a search bar with a magnifying glass submit icon inside the border of the box. When I comment out the image input, the textbox sits perfectly inside the div. When I uncomment the image input, the textbox shifts down by a few pixels. What is it about adding the image element that causes the textbox to shift around?

HTML:

<div id="top_search_box">
    <input type="text" name="keywords" id="keywords" value="Search this site" size="15" maxlength="80"/>
    <input type="image" id="search_button" src="images/layout/search_icon.png" alt="Submit"
                       name="submit" value="Submit"/>
</div>

CSS:

#top_search_box {
  border: 1px solid #dedede;
  height: 25px;
  margin: 4px 0;
  padding: 4px 0;
}

#top_search_box #search_button {
  height: 24px;
  width: 33px;
}

#top_search_box #keywords {
  width: 190px;
  height: 24px;
  border: 0;
  padding: 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:15:10+00:00Added an answer on May 25, 2026 at 3:15 am

    This is how I’d do it.

    HTML

    <input type="submit" value="Submit" />
    

    CSS

    #top_search_box input[type=submit]{
      background: url(images/layout/search_icon.png) no-repeat;
      height: 24px;
      width: 33px;
      padding: 0;
      margin: 0;
      text-indent: -9999em;
    }
    

    For IE you might want to set the value of the Submit button to “”

    I’m assuming you don’t want the value of the input overlaying the image. If you do, simply remove the text-indent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div containing two input elements of type text and a label
I have a situation that i have a hidden div with two input elements
I have two elements: <input a> <input b onclick=...> When b is clicked, I
On the form, I have one select and two input fields. These elements are
I have two input elements. One is to put your email and the other
say i have these two uniquely ID'd divs with input elements that are not
I have two objects, let's call them Input and Output Input has properties Input_ID
I have several DIVs on a page. Inside these DIVs I have several form-elements
I have an input[type=radio] element inside a block container of fixed width. The supporting
I have two divs that are float:left: <div id=inventor> <table> <tr id=1><td>Alexander Graham Bell</td></tr>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.