www.webdeveloper.com
Results 1 to 4 of 4

Thread: Margin/Padding Top

  1. #1
    Join Date
    Jul 2008
    Posts
    31

    Margin/Padding Top

    How come putting a top margin or padding on ".content_top .title" doesn't affect anything? I want the .title text to be pushed down a few pixels so it is vertically centered inside of the content_top div. Can anyone tell me why it won't do anything? Margin/padding left and right both work, just not top.


    HTML Code:
    <html><head>
    <style type="text/css">
    
    * {
    	padding: 0;
    	margin: 0;
    }
    
    .content_top {
    	width: 800px;
    	height: 30px;
    	margin: 0 0 0 0;
    	background-color: #ff0000;	
    }
    
    .content_top .title {
    	color: #000000;
    	margin: 0 0 0 20px;
    	padding: 0 0 0 0;
    	font-size: 18px;
    	font-family: sans-serif;
    	font-weight: bold;
    }
    
    .content_middle {
    	width: 800px;
    	text-align: justify;
    	background-color: #00ff00;
    }
    
    .content_middle p {
    	padding: 0;
    	color: #333333;
    	margin: 0 12px 0 12px;
    	font-size: 12px;
    	font-family: sans-serif;
    	text-indent: 15px;
    }
    
    .content_bottom {
    	width: 800px;
    	height: 18px;
    	margin: 0 0 0 0;
    	background-color: #0000ff;
    	padding: 0;
    }
    </style>
    </head>
    <body>
    
    				<div class="content_top"><span class="title">Post Title</span></div>
    				<div class="content_middle">
    					<p>This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  This sgsudg hsghu suhgasu ashg sghuhgaa fghdmn vb zbv sgug zjvgz zsuegr zn nf.  </p>
    				</div><div class="content_bottom"></div>
    
    </body>
    </html>

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Jul 2008
    Posts
    31
    So from what I understand they just made them for the ease of the lazy coders who don't understand "margin: 1px 0;" would affect both top and bottom?

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    It is useful with lists, but it does cause problems if you are unaware of the collapsing issue.
    http://complexspiral.com/publication...psing-margins/
    At least 98% of internet users' DNA is identical to that of chimpanzees

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles