Using SVG SVG is an image format for vector graphics. It literally means Scalable Vector Graphics. Basically, what you work with in Adobe Illustrator. You can use SVG on the web pretty easily, but there is plenty you should know. Why use SVG at all? Small file sizes that compress wellScales to any size without losing clarity (except very tiny)Looks great on retina displaysDesign control like interactivity and filters Getting some SVG to work with Design something in Adobe Illustrator. Notice the artboard is cropped up right against the edges of the design. You can save the file directly from Adobe Illustrator as an SVG file. As you save it, you’ll get another dialog for SVG Options. The interesting part here is that you can either press OK and save the file, or press “SVG Code…” and it will open TextEdit (on a Mac anyway) with the SVG code in it. Both can be useful. Using SVG as an <img> If I save the SVG to a file, I can use it directly in an <img> tag. In Illustrator, our artboard was 612px ✕ 502px. <!
Adaptive Images in HTML Adaptive Images for Responsive Designs So you’ve been building some responsive designs and you’ve been working through your checklist of things to do: You started with the content and designed around it, with mobile in mind first. You’ve gone liquid and there’s nary a px value in sight; % is your weapon of choice now. You’ve baked in a few media queries to adapt your layout and tweak your design at different window widths. You’ve made your images scale to the container width using the fluid Image technique. You’ve even done the same for your videos using a nifty bit of JavaScript. You’ve done a good job so pat yourself on the back. HTML has an <img> problem CSS is great at adapting a website design to different window sizes – it allows you not only to tweak layout but also to send rescaled versions of the design’s images. HTML is less great. Well, OK. Adaptive image techniques There are a number of possible solutions, each with pros and cons, and it’s not as simple to find a graceful solution as you might expect. Adaptive Images
Choosing a viewport for iPad sites - Allen Pike The iPad has made choosing a good viewport tag for your site more challenging. You now need to specify something that looks good with your content for screens that are 320px, 480px, 768px, and 1024px wide. Viewports Mobile Safari presents desktop-sized sites on small screens by rendering to a virtual browser screen that is 980px ((Of course, when the iPad is in landscape orientation of 1024px wide, it will use 1024px.)) wide, and letting you pan and zoom that page. Viewport tags let you tell Mobile Safari that your site displays properly narrower than 980px, and set other preferences for scaling your page. Craig Hockenberry famously determined the ideal viewport tag for content sites in the iPhone era. The Apple tech note ”Preparing Your Web Content for iPad” has a good suggestion: avoid hard-coding a width for your viewport. This is an improvement, but your content will still be blown up if your device is in landscape mode. Avoiding Blowup The initial-scale Hack
A Pixel Identity Crisis A note from the editors: This article was augmented post production with vendor prefix information to cover Webkit-based and Opera browsers. The pixel has always been the smallest unit in screen-based design. Because it’s been indivisible, it is the concrete unit of measurement among screen-based designers. Article Continues Below Now that hardware is changing and pixel densities are growing, pixels are struggling to find relevance as the stable unit they once were. The hardware pixel#section1 Most of us are familiar with the hardware pixel. The reference pixel and splitting atoms#section2 Things are changing for the pixel. Reference pixels are amazing, but now we have two conflicting definitions. Fig. 1: Standard pixel sizes on the Galaxy Tab and Kindle Fire. We also don’t know what each device considers a pixel and this is a problem. Identifying break points and moving forward#section3 It’s safe to say there is a problem with pixels. Managing multiple pixel definitions can be tricky.
» Responsive IMGs — Part 1 Cloud Four Blog In my post “Where are the Mobile First Responsive Web Designs”, I noted that one of the first things I look for when trying to determine whether or not a responsive web design is “mobile first” is whether or not it has a strategy for handling the IMG tag. A recent Smashing Magazine round up of responsive web design techniques included several new approaches for handling IMG tags which makes it the perfect time to dig into this problem and the potential solutions in more depth. Why IMG Tags Suck for Responsive Web Design If you want your site to load as quickly as possible, you do not want to deliver larger files than are needed. Many responsive web design sites provide mobile devices images at sizes appropriate for desktop and ask the mobile device to resize the image. In my research, I found nearly 80% decrease in file size by delivering images at the actual size they were going to be used on a mobile device. So what’s the problem with the IMG element in responsive designs?
» Responsive IMGs Part 2 — In-depth Look at Techniques Cloud Four Blog Responsive IMGs Part 2 — In-depth Look at Techniques In Responsive IMGs Part 1, I took a high-level look at what responsive IMGs are, the problem they are trying to solve, and the common issues they face. In this post, I’m going to take a deeper look at the specific techniques being used to provide responsive IMGs and try to evaluate what works and doesn’t. If you haven’t read part 1, you may want to do so before reading this post as it will help explain some of the terms I use. When I started working on this project two months ago, I thought I would get to the end and be able to say, “Here are the three approaches that work best. Go download them and figure out how to integrate them into your systems.” What I’ve found is that there is no comprehensive solution. Because of this, the best thing we can do is understand the common elements and challenges so that we can start to pick the best parts of each for building our own solutions. So um… this is a long post. Abandoned approaches 1. 2.
How to use src.sencha.io This Guide is most relevant to Sencha Touch, 1.x. Sencha.io Src helps you dynamically resize images for the ever increasing number of mobile screen sizes. We’ve previously done a lot of work in Sencha Touch to make your UI resolution independent, and Src expands this to include your image assets. It’s easy to use, and in this guide, we run through the main API options for the service. Sencha.io Src is essentially a proxy that lies between image assets (hosted either on your own server or by a third party) and the browser or application requesting them via HTTP. Let's start with a quick example. To use Sencha.io Src in its default mode, you simply prefix your absolute src attribute with Add that into the tag and your image will be magically resized for a smaller, mobile screen: Unless you tell it otherwise, Sencha.io Src will resize the image to fit the physical screen of the mobile handset visiting your site, based on its user-agent string. Defined sizing Orientation
scottjehl/picturefill johnkoht/responsive-images Which responsive images solution should you use? There are a bunch of techniques going around for dealing with responsive images lately. That is, solutions to help us serve the right image for the occasion (e.g. size of screen and bandwidth available). They all do things a bit differently. The spreadsheet has the data, but let's digest it through thinking about it through the lens of practical questions. To choose which technique is right for you and your project these questions may help as a guide. Do I have legacy content? Which really means... do I have legacy content that is impractical to update? The only technique I know of that works with absolutely no markup changes is Adaptive Images. Another question to ask yourself is if you care about legacy content. If you have a small project, a brand new project, or a project with legacy content that you are able go back and update, you are also able to choose a technique which does require special markup, so also read on. Do I care about special markup? Do I care about semantics? Share On