Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Why cant I see a top margin?

    hi guys..

    Just wondering why I cant see a top margin? Am i missing something here? Shouldn't there be a margin of 50px on top? You can simply copy and paste the below code to see what i mean.

    Thanks in advance.

    Here is the code:

    Code:
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>calculating element dimensions</title>
    <!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <style>
    aside, article, section, header, footer, nav {
    	display: block;
    }
    div, p {
    	margin: 0;
    	padding:0;
    }
    html {
    	background: #ccc;
    }
    .outer {
    	width: 600px;
    	height:600px;
    	margin: 0 auto;
    	background: blue;
    }
    .box{
    	background: green;
    	width:400px;
    	padding:50px;
    	border:2px solid black;
    	margin:50px;
    }
    p {
    	background: yellow;
    	
    }
    	
    /*add styles here*/
    
    </style>
    </head>
    <body>
    <div class="outer">
    	<div class="box">
    		<p>	Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor 
    			incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud 
    			exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor 
    			in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
    			Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    		</p>
    	</div>
    </div>
    </body>
    </html>

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,480
    Thanks
    6
    Thanked 981 Times in 954 Posts
    There is a top margin. But you are probably witnessing collapsing margins.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •