Monaen's WikiResponsive Images 2017-03-17
Suggestions
Note: There MUST be a space on each side of the
+
and-
operators. (A space is not required around*
and/
as the problem is an ambiguity around negation.) For example:calc(100px - 10%)
will work.calc(100px-10%)
will not.100vh
,100vw
, corresponding to the 100 percent of the viewport height or viewport width.
Examples
- The way to show three images in a row with 10px gap between each two of them.
1
2
3
4
5
6
7
8
9
10
11
12
13<style>
body {
margin: 0;
}
img {
float: left;
width: calc((100% - 20px)/3);
margin-right: 10px;
}
img:last-of-type{
margin-right: 0;
}
</style>
How to choose the right image format
Image process for webpage
- ImageMagick:
- ImageMagick
- Simple ImageMagick installer for Mac
- GraphicsMagick (a fork of ImageMagick)
- Grunt:
- Udacity webcast for setting up Grunt: Front End version and Full Stack version.
- Getting started with Grunt
- Grunt for People Who Think Things Like Grunt are Weird and Hard
- Generate multi-resolution images with Grunt
- grunt-responsive-images plugin for generating multiple images
- grunt-respimg plugin for a responsive image workflow
- Files used in scripting examples:
- convert.sh (includes instructions)
- Gruntfile.js (remove line 7,
engine: 'im',
on Windows) - Imager.js: responsive image loading developed for BBC News
- Image processing tools:
- ImageOptim (Mac only)
- Trimage - Similar to ImageOptim (Windows, Mac, Linux)
- ImageAlpha
Resources
- HTTP Archive: Average bytes to open a web page
- W3C web page from 1996
- Brian Fling: ‘Great mobile products are created, never ported.’
Relative Sizing
Here are some examples compared to know the properties of responsive images