• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Strange CSS behaviour

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone please explain me why the top and bottom margins of the inner box comes as zero in the output (http://jsbin.com/ikate4) from the code listed bellow:

(If the commented CSS portion comes into effect, the output comes as expected)

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Why is this?</title>
<style type="text/css">

.outter-box {
width: 900px;
/* border: 1px solid gray;*/
margin: auto;
background-color: gray;
}

.inner-box {
height: 300px;
width: 500px;
margin: 10px;
background-color: yellow;
}
</style>
</head>
<body>
<div class='outter-box'>
<div class='inner-box'>
</div>
</div>
</body>
</html>
 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags. Unformatted code is just too hard to read.
 
Seriously? That's what you're going with? I prefer this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic