Reputation: 944
I have a div inside another div.
jsFiddle: http://jsfiddle.net/eT7U9/263/
.primaryMenu .Wrap {
border:thin solid black;
margin-left: 100px;
height: 100%;
}
I want the inner div to shift a bit towards right side and for that I provided "margin-left: 100px;" But this didnt work. Can someone please tell me why? And whats the correct way to do it?
Another question: When I give 50% width(or any width, in fact) to the inner div, it acquires the centre position of the parent Div. Why is it so? Shouldn't it just stay there at top left with width 50%?
Upvotes: 1
Views: 208
Reputation: 94469
The markup negates the margin with an inline style.
<div class="Wrap" style="margin: 0 auto;">
Inline styles will take precedence over a CSS class. Remove the inline style from the div
.
<div class="Wrap">
This should also fix the 50% issue you cite, since it was specifying auto
for the left and right margins in the inline style.
Working Example http://jsfiddle.net/eT7U9/265/
Upvotes: 2