Search code examples
cssimageresponsive-designmarginresponsive

An alternative to negative


I'm using negative margin for making images closer together.Without margin:
Without marginWith margin:
With marginmargin:
margin it works perfectly in full screen. But after making screen smaller it looks like this.smaller:
smaller is there any alternative to negative margin? Or can I make it stable? Sorry guys this is my first time asking question. I searched everywhere for an answer. Any suggestions would be helpful.


Solution

  • Try using percentages for the margins instead of px. Also, I've always had better luck with padding than margin in general, but I don't know that padding will fix the issue.