brunjo / rowGrid.js

A small, lightweight JavaScript plugin for placing items in straight rows (jQuery and vanilla JS version) – Demo:
http://brunjo.github.io/rowGrid.js/
MIT License
670 stars 78 forks source link

no need to "float" items #1

Closed yairEO closed 9 years ago

yairEO commented 10 years ago

Using floats (in this manner) is considered bad practice. Please use inline-block and if your HTML is not minified, then you will have to hack the container with font-size:0.

brunjo commented 10 years ago

Why is it a bad practice? I do not see the point. The performance of floats is even a little better: https://github.com/mdo/css-perf#grid-techniques. I think it is a matter of opinion if float or inline-block is better. What do you think?

yairEO commented 10 years ago

float's need to be cleared, and floats cannot be centered. If you think about it, float is something that needs to be floated next to a non-floated element, to be out-of-context. The condition best describing the semantics of your grid's items is inline-block which is what each item, a box which is inlined with other boxes. float should only be used where no other display solution can be achieved.

In another subject, what would be the performance of your gallery when dealing with thousands of items? The javascript is not designed to handle large amounts of items, since there no optimizations for performance..the key is to cache items, access the DOM as few times as possible and consider bulk updating and replacing the whole container's html every time. also it's very important to NOT use jQuery where ever possible, since it's very slow.

I want to say that I really love your plugin, it's really, truly, a good one!

brunjo commented 10 years ago

Thanks yairEO, I appreciate your advices.

brunjo commented 9 years ago

FYI the plugin does not require a float grid system you can also use display: inline-block without problems.