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 4604584
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:18:59+00:00 2026-05-22T00:18:59+00:00

I have a div . And I’m trying to pad around the text 5px

  • 0

I have a div. And I’m trying to pad around the text 5px — no more, no less — but there’s some extra spacing being thrown in there, like my browser is laughing in my face at my futile attempts to get this to do what I want it to do.

Here’s the CSS I’m using:

div{
    font-family:'Arial', sans-serif;
    padding:5px;
    font-size:14px;
}

And here’s my HTML:

<div>
    Sort By:
    <select>
        <option>Customer</option>
    </select>
    Search Customer:
    <input type="text">
</div>

(No styling’s going on for the input and select fields, by the way.)

And here’s the output I’m getting in my browser window

(highlighted with Chrome’s developer console to give you an idea of the extra spacing going on):

html output http://img715.imageshack.us/img715/2438/padding.png

Wait a second, what’s going on there? I’ve got 5px of padding all around, and then this weird inner padding going on. I measured it in an image editor, and that extra padding or whatever I should be calling it is adding an additional 8px of padding, top and bottom.

Thought it might be a line-height problem — so I set that to 0. Didn’t change a thing. Tried setting it to a negative number. Didn’t work, either; in fact, Chrome wanted nothing to do with that and gave me an error.

So what’s this extra stuff doing here? Does it have a name? Can I shrink it? I want exactly 5px of space around those letters, not a nearly-three-times-as-much 13px.

I appreciate the help — thanks in advance.

  • 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-22T00:19:00+00:00Added an answer on May 22, 2026 at 12:19 am

    The form elements may be expanding the containing element. It’s hard to tell, since you didn’t include them in your screenshot for some reason.

    If you set overflow: hidden on your div, you may see this behaviour stop. Of course, you probably don’t want this; you may be better off trying to manually set the height of those form elements, and ensure that they have margin: 0 set.

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

Sidebar

Related Questions

I have a div with a set height of 200, and sometimes there's enough
I have next problem: There is jquery accordion control. One of tab have div
I'm trying to create a div which will have fixed width and flexible height
I have div containing multiple divs and text. The inner divs are alternately floated
I have div of fixed width containing only input text box and width of
I have JS generated content and want a div EXACTLY around it. I don't
I have div with the following css style: width:335px; float:left; overflow:hidden; padding-left:5px; When I
I have div elements and hold text/string inside them, then I try to iterate
I have a DIV that slides open to the height of the content, but
I have a div full of text, photos, etc. It is generated dynamically, and

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.