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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:05:48+00:00 2026-06-18T01:05:48+00:00

Well I have this code which is fairly simple and should set margin-top of

  • 0

Well I have this code which is fairly simple and should set margin-top of HTML 5’s button element to 1px when it is active ( mouse clicked on it). But what I get is a messed up layout, because the button does what it should do only it does it for both of the buttons which are right next to each other. Can you tell me what is causing this error to occur?

Here is a sample HTML code (because i cant just link to jsfiddle), but the link to jsfiddle is right at the bottom

<header id="main_header"> <!-- this is your header with logo, menu, login and get started now buttons -->
    <div id="header_accent"></div> <!-- small accent image, barely seen on top of the page -->
    <div id="header_holder"> <!-- this guy centers the header to the middle of the page's width -->
        <img src="images/logo.png" alt="ssl8.com" id="logo"/> <!-- logo image -->
        <div id="nav_holder"> <!-- positions the navigation and buttons -->
            <nav>
                <ul> <!-- navigation -->
                    <li class="active"><a href="#">prices</a></li>
                    <li><a href="#">features</a></li>
                    <li><a href="#">contact</a></li>
                </ul>
            </nav>
            <button class="login">login</button> <!-- login button -->
            <button class="getStartedNow">Get started now</button> <!-- get started now button -->
        </div>
        <div id="header_shadow"></div> <!-- holds the background shadow for the header (in CSS file) -->
    </div>
</header> <!-- END of header -->

Here is jsfiddle.Ignore missing pictures etc, just click on the orange button and you will see what i am talking about.

jsfiddle

Thank you

  • 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-18T01:05:49+00:00Added an answer on June 18, 2026 at 1:05 am

    Here is my solution http://jsfiddle.net/burn123/emfwA/16/

    What I Changed

    1. You had the opacity, box-shadow, transitions, and border-radius set for the buttons set on both buttons, which is redundant. I changed it so that it would apply to all buttons
    2. Browser prefixes are not needed for box-shadow or border-radius
    3. For your login button, you forgot the period before your login class, so the css was trying to find a element named login, which doesn’t exist
    4. Removed the active and hover from both elements and set a generic active and hover pseudo element
    5. Added position relative to each button
    6. On active, the button will be given a property of top: 1px
    7. Changed the size of the header to min-width:100% so that the line will go all the way across

    The main problem was coming from the fact that your buttons were set at a position of static, so by applying a margin-top of 1px, you were shifting the entire top down. By setting a position of relative, you can add properties such as top or left and it will move the element in that direction while still keeping the space of the element in the same position

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

Sidebar

Related Questions

I have this code which works well but I don't know if it is
I have this code in Python which runs perfectly well. What it does is
Well I have this code in my Managed C++/Cli in Visual Studio 2008, I
I have this code that works well: {livre:empty_name} $.ajax({ url: sent.php, type: post, dataType:
i have this PHP code, and a DataBase with Question, answer1, answer2, Question_id well,
I have this structure in my html document: <p> <em>You</em> began the evening well,
We have an ashx image handler which has performed fairly well over the last
I have a fairly simple Django application (v1.3 on Red Hat) for which I'm
I'm just playing around with jqGrid this afternoon, and have it working fairly well
Well currently I have this: <rich:fileUpload addLabel=Agregar clearAllLabel=Quitar todos clearLabel=Quitar deleteLabel=Quitar doneLabel=Completado uploadLabel=Subir archivos

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.