How to make it Responsive?


range: [
'0px to 760px = mobile.css',
'760px to 980px = 720.css',
'980px = 960.css'
]
Design a UI that is easy to use.
On a mobile device a button will be easier to click than a text link, so make sure all of your important UI elements are properly sized for a finger and have enough spacing between them. Avoid using the CSS hover event for displaying elements like overlays or drop down lists, because on a touch device these events do not register properly. A simple and safer method would be to use jQuery to register the click and not the mouse enter event if the user is browsing through a mobile device. Detect if the user is browsing through a mobile device with this handy JS snippet.
if ( isMobile.any() ) {
$('.show').on({
click:function() { $(‘.hidden’).show(); }
});
} else {
$('.show').on({
mouseenter:function() { $(‘.hidden’).show(); }
});
}
Some tricks in the trade:
Give your elements a natural box-model with the box-sizing:border-box; CSS property. This is not highly needed for responsive design, but it will give you the perfect sizing model for an element, so nothing is added to your elements width if you increase the padding or the border. Further reading at the end.
div.full-width-box {
width: 96%;
margin-left: 2%;
margin-right: 2%;
}
Speed up your effects with hardware accelerated CSS properties. 3D CSS transform are the best way, not the safest though, for modifying your elements. A simple example would be hiding an element of the page when you use an Off Canvas layout. Combine that with a transition and you've got an even smoother experience.
div.hidden-column {
/* Add a transition */
transition:all linear 0.3s;
-webkit-transition:all linear 0.3s;
-moz-transition:all linear 0.3s;
/* Hiding the column from the viewport */
-webkit-transform: translate3d (-320px, 0, 0);
-moz-transform: translate3d (-320px, 0, 0);
-ms-transform: translate3d (-320px, 0, 0);
-o-transform: translate3d (-320px, 0, 0);
transform: translate3d (-320px, 0, 0);
}
div.hidden-column.visible {
/* Show the column when a class "visible" is added */
-webkit-transform: translate3d (10px, 0, 0);
-moz-transform: translate3d (10px, 0, 0);
-ms-transform: translate3d (10px, 0, 0);
-o-transform: translate3d (10px, 0, 0);
transform: translate3d (10px, 0, 0);
}
Now with jQuery we can add a class to that element when a control button is pressed.
$('.control-button').on({
click:function(){
$('.hidden-column').toggleClass('visible');
}
});
The above will cover only a handful of things you can achieve using fluid layouts, adapt.js and awesome CSS3 properties. Do not be afraid to exploit external resources or use already built layouts or grids. Some of the best articles and website that can help you get your foot through the door.
