background preloader

5 Useful CSS Tricks for Responsive Design

5 Useful CSS Tricks for Responsive Design
Making the design to be responsive is very easy as shown in my Responsive Design in 3 Steps tutorial, but maintaining the elements to look aesthetically balanced on all breakpoint layouts is an art. Today I’m going to share 5 of my commonly used CSS tricks along with sample cases for coding responsive designs. They are simple CSS properties such as min-width, max-width, overflow, and relative value — but these properties play an important part in responsive design. View Demos 1. This responsive video CSS trick was discovered by tjkdesign.com. 2. Max-width property allows you to set the max width of the element. Max-Width Container In the example below, I specify the container to display at 800px if possible, but it should not exceed 90% of the boundary width. Responsive Image You can make the image auto resize to the max width of the boundary by using max-width:100% and height:auto. The above responsive image CSS works on IE7 and IE9, but doesn’t work on IE8. Min-Width 3. Relative Margin 4.

Andrew Brennan | Tablet Screen Dimensions for Responsive Web Design I’m in the process of teaching myself responsive web design as I redesign my portfolio site. If you don’t know, responsive web design is the concept that a website layout should respond to the size of the screen it is being viewed upon. That is, a website will look different on (and be optimized for) a cell phone or iPad than it would on a traditional laptop or desktop monitor. If you’ve ever tried to view a regular, non-mobile website on your smartphone, you know what the significant difference in screen sizes can do to a website. The problem I’ve encountered, however, is that this is a relatively new area and I’m not finding a clear-cut “how to” guide anywhere for newbies like me. I suspect there are guides in books that I would have to pay for, but I’ve already bought a half-dozen of web design books that I don’t use all that much. For smartphones, I’m using the iPhone’s screen size of 320 x 480 pixels as a rule of thumb.

Troubleshooting CSS Sometimes CSS can be frustrating. Learn about some tricky properties, the common issues they can cause and how to solve them. CSS is a mess. First introduced in ~1995, it was meant to style basic text documents. A lot of things were not intended in the first place like multi-column layouts, responsive web design and more; this is why it has become a language full of hacks and glitches, like some kind of odd steam machine with a bunch of extensions. On the bright side, this is what makes CSS fun (or kinda)! Photo credits Anyway, I’m not here to talk about my convictions but about CSS. Among others, I picked some really common yet annoying issues: Float clearing, an old battle I think this has to be the most common wat? Basically, when an element only contains floated elements, it collapses on itself. There are a number of ways to fix this. Then Nicolas Gallagher came with a new way to clear floats from the parent without touching the markup at all. How to fight inline-block spacing? Why?

Beginner’s Guide to Responsive Web Design Whether you’re a beginner or a seasoned web professional, creating responsive designs can be confusing at first, mostly because of the radical change in thinking that’s required. As time goes on, responsive web design is drifting away from the pool of passing fads and rapidly entering the realm of standard practice. In fact, the magnitude of this paradigm shift feels as fundamental as the transition from table based layouts to CSS. Simply put, this is a very different way of designing websites and it represents the future. Free trial on Treehouse: Do you want to learn more about responsive web design? Over the past year, responsive design has become quite the hot topic in the web design community. What is responsive design? Let’s just get right into it: Believe it or not, the Treehouse blog that you’re reading this article on is actually a responsive design! It’s hard to talk about responsive design without mentioning its creator, Ethan Marcotte. So, what is responsive design exactly?

Responsive Web Design: What It Is and How To Use It Advertisement Almost every new client these days wants a mobile version of their website. It’s practically essential after all: one design for the BlackBerry, another for the iPhone, the iPad, netbook, Kindle — and all screen resolutions must be compatible, too. In the next five years, we’ll likely need to design for a number of additional inventions. When will the madness stop? It won’t, of course. In the field of Web design and development, we’re quickly getting to the point of being unable to keep up with the endless new resolutions and devices. Responsive Web design is the approach that suggests that design and development should respond to the user’s behavior and environment based on screen size, platform and orientation. The Concept Of Responsive Web Design Ethan Marcotte1 wrote an introductory article about the approach, “Responsive Web Design992,” for A List Apart. Transplant this discipline onto Web design, and we have a similar yet whole new idea. Adjusting Screen Resolution

Details | Adaptive Images Limitations I think this is one of the most flexible, future-proof, retro-fittable, and easy to use solutions available today. But, there are problems with this approach as there are with all of the one’s I’ve seen so far. This is a PHP solution. I wish I was smarter and knew some fancy modern languages the cool kids discuss at parties, but I don’t. Content Delivery Networks. Adaptive Images relies on the server being able to intercept requests for images, do some logic, and then send one of a given number of responses. A minor but interesting Cookie setting issue. As Yoav Veiss pointed out in his article Pre-loaders, Cookies, and race-conditions there is no way to guarantee that a cookie will be set before images are requested - even though the JavaScript that sets the cookie is loaded by the browser before it finds any <img> tags. Adaptive Images checks the User Agent String for the presence of 'mobile'. The Future For today, this is a pretty good solution.

16 Useful Responsive Navigation Menu Plugins and Tutorials Nowadays many people start to develop a website or blog that has responsive layout to improves the user experience and web-usability, especially for mobile users. There are so many responsive WordPress theme or website template that you can use for free/paid – By using this themes your website will more flexible to any web browsers, It’s really easy to transform your website to be more responsive and mobile user-friendly without getting your hands dirty in code - check this out, If you prefer to learn to make responsive websites yourself, it’s little harder way but can be an opportunity to improve your skills. You might also like; 1. Tutorial | View the demo 2. Tutorial 3. Tutorial | View the demo 4. Tutorial | Download | View the demo 5. Tutorial | View the demo 6. Tutorial | Download | View the demo 7. Tutorial | Download | View the demo 8. Tutorial | View the demo 9. Download | View the demo 10. Tutorial | View the demo 11. Tutorial | Download | View the demo 12. Download | View the demo 13. 14.

Responsive webdesign : adapter un site à toutes les résolutions Le Responsive webdesign (conception adaptative ou réactive en français) représente un ensemble de méthodes et techniques permettant d’universaliser un site Web. Qu’il soit consulté sur ordinateur, tablette, e-reader ou mobile, le site ainsi conçu s’adapte automatiquement à la taille de l’écran. Cette évolution très séduisante du Web pose néanmoins certaines questions d’ergonomie et oblige à repenser la conception des sites. Nous abordons dans cet article les objectifs du responsive design, les critères qui doivent décider à le mettre en œuvre, les recommandations de conception et les considérations techniques. Objectifs du responsive webdesign Pour commencer, rien de tel qu’une démonstration. Entrons dans le vif du sujet. Les sites Web sont aujourd’hui consultés sur une multitude d’appareils ayant des résolutions différentes Proposer une seule version du site Web censée s’adapter à tous ces terminaux est utopique. Le site ifttt n’est pas adaptable. Responsive ou versions séparées ?

Using Custom Data Attributes and Pseudo-Elements A tutorial on how to (ab)use custom data attributes and pseudo-elements for creating image captions. In today’s tutorial I want to show you some simple CSS tricks using data attributes and pseudo-elements. The aim is to create an image caption using only an anchor and an image as markup. We’ll be exploring how to create pseudo-elements from some data attribute values and use them in a hover effect or simply show them next to the image. Using (more) semantic markup is of course what you should be doing, especially for data that is important to be shown. If you’d like to explore some fancy image caption hover effects with “real” markup, check out the Caption Hover Effects. And if you are interested in some really cool animations and transitions with pseudo-elements, then check out this article by Marco Barria: Examples of Pseudo-Elements Animations and Transitions. The demos feature some beautiful artwork by Jaime Martinez. Let’s start with the markup. Example 1: Caption next to image

Responsive Web Above The Fold The following post is by Arley McBlain. Arley has written a fewother great articles for CSS-Tricks in the past so I'm pleased to have him back for another! This post's title isn't just a weak attempt at SEO stuffing, it's also a blind-folded scissor kick into a beehive convention! Few topics in web production can bring a nerd's blood to a rolling boil as quickly as "The Fold" and "Responsive Web Design", so it's high time we combine the two and bring this server to its knees under the sheer weight of trolls sharing how they really feel about me as a person. Before the Webbys have to invent the "Best Use of Naivety" award I'd like to point out that for years I've been in the "The Fold is Dead" camp. Nothing used to please me more than comparing a website to the source of the scrolling metaphor; papyrus scrolls (bonus points when I could work a font joke in). Google Analytics is a useful tool, and can do more than just shatter your faith in humanity's ability to upgrade their web browser.

A Beginner’s Guide to Zurb Foundation 3: The Grid In the past, we’ve discussed Twitter Bootstrap quite a bit. Much more so than its most worthy competitor: Zurb’s Foundation. Now on its third iteration, Foundation is a robust and responsive front end framework used by hundreds of developers every day. Over the course of several articles, we’re going to jump in and take a look at its various aspects from a complete beginner’s perspective. Grid Crazy If you’re a regular reader of Design Shack, then you probably already know that I’m a bit of a grid nut. The grid that comes built into Foundation is no exception to this rule. The Foundation Grid Like countless other grids, the foundation Grid is built on a twelve column system. What this means on a code level is of course that each column in the grid does not have a static width but is instead assigned using percentages. Responsive Getting Started If you’re at all used to grid systems, Foundation should be really easy to pick up. Creating a Row How easy was that? Adding Columns Going Further

Tips & Tools for Grid-based Layouts Developing a vertical (and responsive) grid can help maintain consistency in website design and ease the creation of responsive layouts. When you first start planning a web design project where do you start? Color scheme, fonts? Probably not. Most of us start with a sketch outline of the site’s structure. And a big part of this structure lies in the grid – a vertical set of guidelines that help determine shape, placement of items and overall look of each website. There are a variety of grid-based structures. Column Grid Every vertical grid is comprised of two things – columns and gutters. Web grids vary widely and there is no magic formula for number of columns or width of gutters. When using a vertical column-based grid, the lines are typically invisible and only known to the designer or developer. Build a Grid The first step in creating a grid is to set your constraints. When designing the grid, think about how elements will live within the columns. Then it is time to do the math. Analysis

Media Queries Abstract HTML4 and CSS2 currently support media-dependent style sheets tailored for different media types. For example, a document may use sans-serif fonts when displayed on a screen and serif fonts when printed. ‘screen’ and ‘print’ are two media types that have been defined. Media queries extend the functionality of media types by allowing more precise labeling of style sheets. A media query consists of a media type and zero or more expressions that check for the conditions of particular media features. Status of This Document This section describes the status of this document at the time of its publication. A W3C Recommendation is a mature document that has been widely reviewed and has been shown to be implementable. This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. Please see the Working Group's implementation report and the Media Queries Test Suite. 1. 3. 5.

Antwort | Transform Columns to Rows Getting Started » Most responsive email layouts feature single fluid columns, whose contents adjust to the width of the device. This experience may be underwhelming for desktop users who have more real estate for content. To illustrate how to create a more complex and interesting layout, for example columns that transform into rows for smaller screens, we’ll walk through the code in 3columns-to-rows.html, which works across all major email clients, including Outlook. Columns Container Table In your desktop version, to create columns as you would normally would with <table>s not <div>s as some recommend. <table border="0" cellpadding="0" cellspacing="0" class="columns-container"><tr><td class="force-col" valign="top"> Column 1 </td><td class="force-col" valign="top"> Column 2 </td></tr></table> To manipulate the columns into rows, you need the following styles in your <head> I choose a breakpoint of 600pxinstead of 480px to catch small tablets in addition to smart phones. N.B.

Related: