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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:41:58+00:00 2026-06-17T06:41:58+00:00

I have an element in a div that I’m having some problems giving a

  • 0

I have an element in a div that I’m having some problems giving a margin-top.

Instead of moving the element in the div, I can only get it to move the entire div.

It’s the purple circle that I want to give a margin-top.

http://jsfiddle.net/9J8R5/

#step1 {
    width:100px;
    height:100px;
    border-radius:50px;
    background-color:#5020B8;
    left:0;
    right:0;
    margin-left:auto;
    margin-right:auto;
    top:1em;
    font-size:60px;
    color:#ffffff;
    font-family:Cusmyrb;
    line-height:105px;
    text-align:center;
    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-06-17T06:41:59+00:00Added an answer on June 17, 2026 at 6:41 am

    The margin-top doesn’t appear on the child element the way you expect because of margin collapse.

    If there is no border, padding, inline content, or clearance to separate the margin-top of a block with the margin-top of its first child block, or no border, padding, inline content, height, min-height, or max-height to separate the margin-bottom of a block with the margin-bottom of its last child, then those margins collapse. The collapsed margin ends up outside the parent.

    Source: https://developer.mozilla.org/en-US/docs/CSS/margin_collapsing

    If you really want the margin-top to exist on the child element, either of these additions will do it for you:

    #competeinfo {
        border: 1px solid transparent;
    }
    

    http://jsfiddle.net/9J8R5/5/

    Or

    #competeinfo {
        overflow: hidden;
    }
    

    http://jsfiddle.net/9J8R5/6/

    Otherwise, padding on the parent element is probably the best choice.

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

Sidebar

Related Questions

I have a div element that is defined on the top of the page
I have some DIV that fades in by clicking another DIV trigger element. I
I have some DIV that fades in by clicking another DIV trigger element. I
i have some div element that scrolls to another position, when you click on
I have a div that will serve as container to other element, I have
I have a basic div element to represent a message that I show for
I have a script that create a new div element. Then, I want to
I have code that adds a pre-determined HTML snippet into a pre-determined <div> element
I have DIV element which only has a few lines in and a background
So i have one div element that i append on my DOM with a

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.