1998!
(Note: as of 7/2008, this only works in Firefox 3)
function drawCentered(ctx, marginLeft, top, boxWidth, text) {
ctx.save();
var textSize = ctx.mozMeasureText(text);
var centerLeft = (boxWidth - textSize) / 2;
ctx.translate(marginLeft + centerLeft, top);
ctx.mozDrawText(text);
ctx.restore();
}
function drawWarning(){
var canvas = document.getElementById('canvasArea');
var ctx = canvas.getContext('2d');
var boxWidth = 400; var boxHeight = 200;
var marginLeft = 20; var marginTop = 20;
var strokeSize = 1; var fontSize = 20;
ctx.strokeStyle = "#f00";
// Draw Box
ctx.fillStyle = "#ff0";
ctx.fillRect(marginLeft + strokeSize,
marginTop + strokeSize, boxWidth, boxHeight);
ctx.strokeRect(marginLeft, marginTop,
boxWidth + strokeSize, boxHeight + strokeSize);
// Draw Text
ctx.fillStyle = "#f00";
ctx.mozTextStyle = fontSize + 'px Arial';
var lineHeight = fontSize * 2;
marginTop += lineHeight;
drawCentered(ctx, marginLeft, marginTop, boxWidth,
'WARNING: Wishes Will Be');
marginTop += lineHeight;
drawCentered(ctx, marginLeft, marginTop, boxWidth,
'Taken Literally');
}
<html>...</html>
body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
overflow: hidden;
}
img {
width: 100%;
height: 100%;
}
.boxholder {
position: relative;
width: 100%;
height: 100%;
}
#hoverbox {
position: absolute;
left: 35%;
top: 0;
width: 33%;
height: 59%;
border: 3px solid #eee;
/* required for IE8 */
background: url(spacer.gif);
}
.title {
display: none;
}
.title:hover {
display: block;
}
.title {
display: none;
}
.title:hover {
display: block;
}
.title {
display: none;
/* IE6 hack */
filter:alpha(opacity=1);
}
a:hover .title {
display: block;
/* IE6 hack */
filter:alpha(opacity=100);
}
.right {
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 1em;
background-color: orange;
}
.right {
position: absolute;
right: 0;
top: 0;
bottom: 0;
width: 1em;
background-color: orange;
}
<table>
<tbody>
<tr class="top">
<td class="left">tl</td>
<td class="middle">tm</td>
<td class="right">tr</td>
</tr>
<tr class="center">
<td class="left">cl</td>
<td class="middle">cm</td>
<td class="right">cr</td>
</tr>
<tr class="bottom">
<td class="left">bl</td>
<td class="middle">bm</td>
<td class="right">br</td>
</tr>
</tbody>
</table>
<div class="gridlayout">
<div class="top">
<div class="left">tl</div>
<div class="middle">tm</div>
<div class="right">tr</div>
</div>
<div class="center">
<div class="left">cl</div>
<div class="middle">cm</div>
<div class="right">cr</div>
</div>
<div class="bottom">
<div class="left">bl</div>
<div class="middle">bm</div>
<div class="right">br</div>
</div>
</div>
table {
table-layout: fixed;
}
.center .middle {
height: 100%;
width: 100%;
}
.left, .right {
width: 30px;
height: 30px;
}
var images; // Filled in elsewhere
function setImageSizeViaJs(size) {
for (var i = 0; i < images.length; ++i) {
images[i].width = size;
images[i].height = size;
}
}
<img src="blah.jpg" style="width: 1em; height: .75em;" />
function setImageSizeViaStyle(size) {
imagelist.style.fontSize = size + 'px';
}
.dj_safari h1 { color: blue; }
.dj_ie h1 { color: red; }
<ul>
<li>
<a href="#01">
<span class="title">
Mission Statement</span>
<div class="short">
Oh please click...</div>
<div class="blah">
Phosfluorescently...</div>
</a></li>
(etc.)
</ul>
li a {
color: #000; width: 180px;
display: block; padding: 0.25em;
text-align: left;
text-decoration: none;
background-color: #eee;
border: 1px solid #aaa;
height: 20px; position: relative;
background:
-webkit-gradient(linear,
left top, left bottom,
from(#fff), to(#00abeb));
-webkit-border-radius: 0.25em;
-moz-border-radius: 0.25em;
}
li a .blah {
width: 550px;
height: 0;
overflow: hidden;
-webkit-transition-property: width, height;
-webkit-transition-duration: 250ms;
-webkit-transition-timing-function: default;
}
li a:visited .blah {
height: 160px;
margin: 1em;
text-align: left;
}
In webkit, go here: Webkit Transforms
<img id="theimage" src="images/moonman.jpg" style="-webkit-transform: rotate(45deg)" onclick="moveImage();">
img {
width: 50%;
position: absolute;
left: 1em;
-webkit-transition-property: -webkit-tranform, left;
-webkit-transition-duration: 500ms;
}
function moveImage() {
var i = document.getElementById('theimage');
i.style.left = '200px';
i.style.webkitTransform = 'rotate(0deg)';
}
In webkit, go here: Webkit SVG Masks
<img src="images/moonman.jpg" style="-webkit-mask-image: url(circle.svg)"> <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg"> <circle id="circlemask" cx="100" cy="100" r="100" stroke="black" stroke-width="2" fill="red"/> </svg>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<body style="background:black;">
<div id="d">
<iframe style="display:block; margin:0 auto; width:80%; height:400px;"
src="basicfloats.html"/>
</div>
<svg:svg style="display:block; height:250px; width:100%;">
<svg:foreignObject width="100%" height="100%" transform="matrix(1 0 0 -1 0 250)" mask="url(#m)">
<div style="background:url(#d); background-position:bottom; width:100%; height:100%;"/>
</svg:foreignObject>
<svg:mask id="m" maskContentUnits="objectBoundingBox">
<svg:rect width="1" height="1" fill="url(#g)"/>
<svg:linearGradient id="g" gradientUnits="objectBoundingBox" x2="0" y2="1">
<svg:stop stop-color="white" stop-opacity="0" offset="0"/>
<svg:stop stop-color="white" offset="1"/>
</svg:linearGradient>
</svg:mask>
</svg:svg>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<body style="background:black;">
<div id="d">
<iframe style="display:block; margin:0 auto; width:80%; height:400px;"
src="basicfloats.html"/>
</div>
<svg:svg style="display:block; height:250px; width:100%;">
<svg:foreignObject width="100%" height="100%" transform="matrix(1 0 0 -1 0 250)" mask="url(#m)">
<div style="background:url(#d); background-position:bottom; width:100%; height:100%;"/>
</svg:foreignObject>
<svg:mask id="m" maskContentUnits="objectBoundingBox">
<svg:rect width="1" height="1" fill="url(#g)"/>
<svg:linearGradient id="g" gradientUnits="objectBoundingBox" x2="0" y2="1">
<svg:stop stop-color="white" stop-opacity="0" offset="0"/>
<svg:stop stop-color="white" offset="1"/>
</svg:linearGradient>
</svg:mask>
</svg:svg>
</body>
</html>
"With browsers, you cut people off at the knees, but everyone's the same height."
-Alex Russell
?