Bootstrap – Removing padding or margin when screen size is smaller

The @media query specifically for ‘phones’ is.. @media (max-width: 480px) { … } But, you may want to remove the padding/margin for any smaller screen sizes. By default, Bootstrap adjusts margins/padding to the body, container and navbars at 978px. Here are some queries that have worked (in most cases) for me: @media (max-width: 978px) { … Read more

Why is the window.width smaller than the viewport width set in media queries

This is what worked for me: CSS media queries and JavaScript window width do not match. Instead of using $(window).width(); which includes scrollbars get the inner width like this: function viewport() { var e = window, a=”inner”; if (!(‘innerWidth’ in window )) { a=”client”; e = document.documentElement || document.body; } return { width : e[ … Read more

How to control number of items per row using media queries in Flexbox?

I had to get rid of the margin around the blocks, because percentage widths are difficult to cleanly apply to elements with margins, but you can see the changes at http://codepen.io/anon/pen/jPeLYb?editors=110 : @mixin max-width($width) { @media screen and (max-width: $width) { @content; } } .container { position: relative; display: flex; flex-flow: row wrap; } .item … Read more