follow along at:
g-liu.com/live
Open up http://codepen.io
<meta name="viewport" content="width=device-width, initial-scale=1" />
Type | Description |
---|---|
all |
All devices (default) |
handheld |
Handheld devices (typically small screen, monochrome, limited bandwidth). |
print |
Paged, opaque material and for documents viewed on screen in print preview mode. |
projection |
Projected presentations, for example projectors or print to transparencies. |
screen |
Color computer screens |
tv |
Television devices (low resolution, color, limited-scrollability screens, sound available). |
Property | What it does |
---|---|
min-height |
Sets the element's minimum displayed height |
min-width |
Sets the element's minimum displayed width |
max-height |
Sets the element's maximum displayed height |
max-width |
Sets the element's maximum displayed width |
Unit | Description |
---|---|
vh |
% of viewport's height |
vw |
% of viewport's width |
vmin |
% of min(height, width) |
vmax |
% of max(height width) |
@media and ( :???) { }
screen
projection
handheld
tv
braille
How can we reduce this time?
Why do we care?
HTTP request reduction
#main p {
font-size: 16pt;
margin-bottom: 0px;
}
#main p{font-size:16pt;margin-bottom:0;}
var mySuperCoolVariable = 3;
mySuperCoolVariable *= Math.random() * 10;
/* Set the value of the input form */
var userDisplayForm = document.getElementById("display");
userDisplayForm.value = mySuperCoolVariable;
var m=3;
m*=Math.random()*10;
var u=document.getElementById("display");
u.value=m;
Yes! (but less common. Why?)
<article id="post-3801">
<h1>First post</h1>
<p>Just setting up my blog</p>
</article>
<article id="post-3801"><h1>First post</h1><p>Just setting up my blog</p></article>
Don't need to. (Why?)
700 kB
250 kB
Can you tell the difference?
Potentially HUGE performance improvements!
header.css
main.css
footer.css
mobile.css
print.css
bigkahuna.css
0.8kB
4.9kB
1.1kB
1.8kB
0.4kB
9.0kB
setup.js
keyboard.js
ie6-support.js
bigkahuna.js
2.1kB
5.6kB
82kB
89.7kB
<li>
<?php
$db = new PDO(...);
$db->query("SELECT * FROM games
WHERE ...");
$rows = $db->fetchAll();
foreach ($rows as $row) :
?>
<li><?= $row['name']; ?></li>
<?php endforeach; ?>
</li>
<ul>
<li>Angry Birds</li>
<li>Minecraft</li>
<li>Halo 4</li>
<li>...</li>
</ul>
First visit
Second visit
Third visit
Fourth visit
...
getGames.php
getGames-cached-201505110838.html
Client
Server
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.0/backbone-min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"
type="text/css"
rel="stylesheet" />
img {
/* Remove one of these lines and
* try on different browsers */
-webkit-filter: hue-rotate(90deg);
filter: hue-rotate(90deg);
}
/* Even worse! */
.foo {
background-color: red; /* fallback */
background-image: url(fallback-gradient.svg); /* IE9 */
background-image:
-webkit-gradient(linear, left top, right top, from(red), to(#f06d06)); /* old webkit */
background-image:
-webkit-linear-gradient(left, red, #f06d06); /* newer webkit */
background-image:
-moz-linear-gradient(left, red, #f06d06); /* old FF */
background-image:
-o-linear-gradient(left, red, #f06d06); /* old Opera */
background-image:
linear-gradient(to right, red, #f06d06); /* modern */
/* Silly IE... */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB)";
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB);
}
=