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

  • SEARCH
  • Home
  • 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 8888083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:57:37+00:00 2026-06-14T21:57:37+00:00

I have a simple html page with a rather simple css , and it

  • 0

I have a simple html page with a rather simple css, and it drives me nuts – I do not at all understand what is happening here (the original task is to create a simple contact form, using modernizr, but I have stripped everything down):

<html>
<head>
    <style>
        body {
            font-size: 16px;
            line-height: 26px;
        }

        label {
            float: left;
            margin-top: 4px;
        }

        input {
            border: 1px solid #ccc;
            margin: 4px;
        }

        input:focus {
            border: 2px solid #900;
        }
    </style>

</head>
<body>
    <label>1:</label><input id="1" /><br />
    <label>2:</label><input id="2" /><br />
    <label>3:</label><input id="3" /><br />

</body>
</html>

The three rows with the labels and the input boxes have increasing left margins, and if I set the focus to any input, the ones below jump back (at least in Chrome and FF). Why?

Now, if I remove virtually any css property, things get stranger:

  1. The original above can be found here.
  2. If I remove the the body line (or even only the line-height: 26px; part!!), the left margin disappears (why?), check here.
  3. If I remove the input:focus line, the jump doesn’t happen anymore (why?), check here.
  4. If I remove border: 1px solid #ccc; from input, the margins are gone (why???), check here.

And there are other interdependencies as well. This doesn’t happen in jsfiddle and other online tools but can be easily reproduced locally.

Bottom line: the whole behavior seems completely alien to me, and I hope a CSS Sherlock Holmes can shed some light on what happens here.

  • 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-06-14T21:57:38+00:00Added an answer on June 14, 2026 at 9:57 pm

    The problem is with the numbered list.

    You are setting a margin-top, and making the line height bigger than the text itself. This is normally fine but this makes the numbers bigger than the input boxes.

    You are forcing a new line with <br /> and they can’t naturally float to where they should be, as the previous number is “too large” for its “line”.

    I’m struggling to explain it, but to fix it you can add line-height: 2; to the input boxes, or any of the fixes you mentioned, or better yet replace it all with an ordered list.

    If you still don’t understand, try setting border: 1px solid #000; on the labels, you will see what I mean.

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

Sidebar

Related Questions

We have a rather simple site (minimal JS) with plain html and CSS. It
I have simple HTML page with svg like this: <div id=plan> <svg xmlns=http://www.w3.org/2000/svg version=1.1>
This is bugging me ... I have a simple HTML page that has a
I'm using PeerTracker http://en.wikipedia.org/wiki/PeerTracker to track torrent hashes. I have a simple HTML page
I have a very simple html page with the following javascript in it $(function()
In a simple html page I have: <SCRIPT> function Clicker(number){ if (number == 1)
I have a simple html form. On php page. A simple list is placed
So I have simple video tag on HTML 5 page playing OGG video. I
I have a simple HTML Table (10 columns x 500 rows). When the page
I have this html page which is very simple, it contains a text box

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.