Reputation: 1601
What I’m trying to achieve is a top border that matches up (i.e. overlaps) exactly with the bottom border of an element above.
Any ideas on how to achieve this?
Upvotes: 2
Views: 12381
Reputation: 3022
Your problem can easily be solved without messing with the margin/padding, just remove the bottom border, which will make it look as if it was overlapping.
border-bottom:none;
If your borders are side by side just remove the right/left border... etc
Upvotes: 0
Reputation: 2663
Can I use negative padding so that together with a border they appear outside the container
No, but you can use negative margin. Anyway, I'd set only left and right border of inner element.
Upvotes: 0
Reputation: 98816
Yup, but not with padding. Use a negative top margin instead.
See http://jsfiddle.net/TD9x7/
Upvotes: 1
Reputation: 21564
either you use negative margins or absolute positioning. negative values are not allowed
Upvotes: 0
Reputation: 17977
Negative padding is not allowed, nor in the CSS spec as far as I'm aware. Padding is for adjustments within the box model, margin is for adjustments outside.
You may be able to achieve the desired affect with a negative margin
margin-top:-20px;
for instance.
But it would help to see your code to offer more assistance.
Upvotes: 6