Reputation: 5
<div id="content">
<div id="rectangle">
<p>Consectetur adipiscing elit. Suspendisse potenti. Maecenas at nulla velit, quis bibendum ligula. Donec neque purus, porttitor et tempor non, molestie nec sem.</p>
</div>
</div>
#content{
margin:0px auto;
height:600px;
width: 600px;
background-color: white;`enter code here`
-moz-box-shadow: inset 0 15px 2px rgba(0,0,0,.07);
-webkit-box-shadow: inset 0 15px 2px rgba(0,0,0,.07);
box-shadow: inset 0 15px 2px rgba(0,0,0,.07);
}
.rectangle {
width: 563px;
height: 165px;
background-color: #e7ebf1;
-moz-box-shadow:
1px 1px 2px rgba(0,0,0,.2) ,
inset 0 0 5px rgba(255,255,255,.6)
-webkit-box-shadow:
1px 1px 2px rgba(0,0,0,.2) ,
inset 0 0 5px rgba(255,255,255,.6) ;
box-shadow:
1px 1px 2px rgba(0,0,0,.2),
inset 0 0 5px rgba(255,255,255,.6)
background-image: -moz-linear-gradient(90deg, rgba(0,0,0,.05) 0%, rgba(255,255,255,.05) 100%);
background-image: -o-linear-gradient(90deg, rgba(0,0,0,.05) 0%, rgba(255,255,255,.05) 100%);
background-image: -webkit-linear-gradient(90deg, rgba(0,0,0,.05) 0%, rgba(255,255,255,.05) 100%);
background-image: linear-gradient(90deg, rgba(0,0,0,.05) 0%, rgba(255,255,255,.05) 100%);
margin: 0 auto;
}
I try to create spacing between boxes on top of each other .
Somehow the both stick on top to each other and i cant manage to have spacing between them.
When i add margin or padding it doesnt change anything .
Upvotes: 0
Views: 109
Reputation: 32202
You added class rectangle
in your CSS but defined id rectangle
in your HTML.
----------- updated give margin-top ------------------ Demo
Upvotes: 0
Reputation: 11
The margin: 0 auto;
is setting the top and bottom margins of the rectangle to 0, so that's why there is no spacing between them.
Set it to margin: 15px auto;
and you will have space.
Upvotes: 0