Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1px gaps and overlaps #916

Open
stempora opened this issue May 15, 2015 · 8 comments
Open

1px gaps and overlaps #916

stempora opened this issue May 15, 2015 · 8 comments

Comments

@stempora
Copy link

Hi

I encounter a problem with isotope and bootstrap. On certain window size the images are overlapping with 1px ( from what i see when the width its xxx.5px )

Seems to be a common issue when the item width its sent in percents.

Is there any fix for it ?

Thanks a lot!

image

@desandro
Copy link
Member

I'm sorry to see you're having trouble with Isotope. Could you provide a reduced test case? See Submitting Issues in the contributing guidelines.

@stempora
Copy link
Author

Hi

You can check it directly in the demo from your site

http://codepen.io/desandro/pen/NqNBxy

Just resize the window and you will see at some point images will start overlapping with 1px.

@robertkyan
Copy link

Also having this problem, is this (#684) still the best solution?

@desandro
Copy link
Member

desandro commented Jun 4, 2015

1px overlaps and 1px gaps are a result of rounding mismatches between displayed sizes of items and their positions on screen. There's no foolproof way to resolve them.

If you prefer 1px gaps over 1px overlaps, you can size items with calc. See demo http://codepen.io/desandro/pen/NqpEbK

.grid-item {
  width: 20%;
  width: calc( 20% - 1px );
}

.grid-item--width2 {
  width: 40%;
  width: calc( 40% - 1px );
}

Closing as wontfix.

@GoodJob
Copy link

GoodJob commented Feb 24, 2016

I just added fixed width:320px; in my case and everything worked just fine. I have no need to make width dynamic, so it works well 👍

@desandro desandro mentioned this issue Jun 28, 2016
@desandro desandro reopened this May 19, 2017
@desandro desandro changed the title Overlapping 1px 1px gaps and overlaps May 19, 2017
desandro added a commit to metafizzy/outlayer that referenced this issue May 19, 2017
@desandro
Copy link
Member

Enough issues have opened up on this issue, so I'm opening this one back up.

I discovered that using fractional pixel values, i.e. 40.12px looks to resolve this issue. Outlayer previously rounded pixel value with setting position. In my previous experience, fractional pixel values resulted in blurry text rendering. That was years ago. Observing this demo, positioning with fractional pixel values looks good.

Outlayer v2.1.1 has been released, with a fix for using float values. Isotope will get this fix in its next release.

@ingeniumdesign
Copy link

we build a issue for this bug:

this.$element .find('.item').each(function(){
    $(this).css('height', 'auto');
    var curHeigght = $(this).outerHeight();
    $(this).css('height', Math.round(curHeight));
});

this is a example for the vertical builder.
we round the px up.

desandro added a commit that referenced this issue Apr 6, 2018
⬆️ get-size 2.0.3, fizzy-ui-utils 2.0.7
@desandro
Copy link
Member

desandro commented Apr 6, 2018

Isotope v3.0.6 has been released with Outlayer upgraded to v2.1.1

@desandro desandro removed their assignment Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants