Hey, look! I found a robot fossil!
Responsive design refers to an approach in web design that provides an optimal viewing experience across a wide range of screen resolutions and devices. This includes easy reading and navigation with a minimum of resizing, panning, and scrolling. This is accomplished using the same codebase and content, instead of separate sites for different devices.
I'm not sure. I'm afraid we need to use ... Math.
target / context = result
<div id="wrapper" class="clearfix" style="width: 960px;">
<section id="secondary" style="width: 320px; float: left;">
...
</section>
<section id="primary" style="width: 640px; float: left;">
...
<article style="width: 500px; float: left;">
...
</article>
<aside style="width: 140px; float: left;">
...
</aside>
</section>
</div>
target / context = result
#secondary
target
= width the box should be = 320pxcontext
= width of its parent #sitewrapper
= 960pxresult
= 320px / 960px = 33.333333%#primary
target
= width the box should be = 640pxcontext
= width of its parent #sitewrapper
= 960pxresult
= 640px / 960px = 66.666667%target / context = result
article
target
= width the box should be = 500pxcontext
= width of its parent #primary
= 640pxresult
= 500px / 640px = 78.125%aside
target
= width the box should be = 140pxcontext
= width of its parent #primary
= 640pxresult
= 140px / 640px = 21.875%width
of the #wrapper
to max-width
<div id="wrapper" class="clearfix" style="max-width: 960px;">
<section id="secondary" style="width: 33.333333%; float: left;">
...
</section>
<section id="primary" style="width: 66.666667%; float: left;">
...
<article style="width: 78.125%; float: left;">
...
</article>
<aside style="width: 21.875%; float: left;">
...
</aside>
</section>
</div>
target
= target padding/margin you wantcontext
= width of the parentem
for those insteadfont-size
to an em
-based value will allow fluid font-sizes
em
is a relative unit
1em
= the font-size of the current context<body>
, which defaults to 16px<h1 style="font-size: 28px;">This is a test <small style="font-size: 16px;">and only a test</small></h1>
<p style="font-size: 13px;">I'm not kidding!</p>
target / context = result
h1
target
= the font-size it should be = 28pxcontext
= the font-size of its parent, body
= 16pxresult
= 28px / 16px = 1.75emp
target
= the font-size it should be = 13pxcontext
= the font-size of its parent, body
= 16pxresult
= 13px / 16px = 0.8125emtarget / context = result
small
target
= the font-size it should be = 16pxcontext
= the font-size of its parent, h1
= 28pxresult
= 16px / 28px = 0.571428571em<h1 style="font-size: 1.75em;">This is a test <small style="font-size: 0.571428571em;">and only a test</small></h1>
<p style="font-size: 0.8125em;">I'm not kidding!</p>
em
too
box-sizing: border-box;
to adjust the box model being used
width
you specify; the padding and border won't be added to it
font-size
of the <body>
and everything else will scape/up down with it!The flight had a stopover on the Brain Slug Planet. Hermes liked it so much he decided to stay of his own free will.
/* General CSS (fonts, colors, etc) + Mobile First Layout */
html { ... }
body { ... }
h1 { ... }
header { ... }
section#main { ... }
/* From 360 pixels width and up */
@media (min-width: 360px) {
/* note: all styles above will be inherited! */
h1 { ... }
section#main { ... }
}
min-width
in em
(src)
/* General CSS (fonts, colors, etc) + Mobile First Layout */
html { ... }
body { ... }
h1 { ... }
header { ... }
section#main { ... }
/* From 360 pixels width and up */
@media (min-width: 22.5em) {
/* note: all styles above will be inherited! */
h1 { ... }
section#main { ... }
}
<!--[if (lt IE 9) & (!IEMobile)]><script src="js/respond.min.js"></script><![endif]-->
viewport
metatag to let mobile browsers properly render the site
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
font-size
of body
and the em
s will do their workdisplay: none;
Please Don't Drink The Emperor!
max-width
to 100%
img {
max-width: 100%;
_width: 100%; /* fix for IE6 who doesn't understand max-width */
}
.htaccess
redirect + resize script: Adaptive Images, Responsive-Images JS, etc.<picture alt="A giant stone face at The Bayon temple in Cambodia">
<source src="small.jpg">
<source src="medium.jpg" media="(min-width: 400px)">
<source src="large.jpg" media="(min-width: 800px)">
<noscript><img src="small.jpg" alt="..."></noscript>
</picture>
video, embed, object {
max-width: 100%;
_width: 100%; /* fix for IE6 who doesn't understand max-width */
}
The Smell-O-Scope is brilliant, I tell you!
Do you, Leela, copy and paste his response
till death do you part?
There is no Mobile Web. There is only The Web, which we view in different ways. There is also no Desktop Web. Or Tablet Web.
If you just make an HTML-Document and you put it on the Web it’s already responsive.
— Jeremy Keith
If you're looking for the more honest, truthful answer to pretty much any question on web design and usability, here it is: It depends.