I have a div which is centred horizontally with css :
.bar {
height: 38px;
width: 970px;
margin-left: auto;
margin-right: auto;
}
I need to have another element to have same margin from the right as .bar, so I'm using jQuery sizes for this :
<div class="spec">I need to be aligned the same.</div>
JS:
$(".spec").css('margin-right', $('.bar').margin().right + 'px');
This works, but not in Firefox 30.0, as it returns 0 for computed margin-right of .bar. Any suggestions ? http://jsbin.com/difobu/1/edit.
$('.bar').css('margin-right') return 0px in FF 30.0 as well. If you donwnvote please provide an explanation.