One True Layout Method
This is a summary layout using the one true layout methol. Works great ie8 and up.
by jacobwsmith
HTML
<h1>One True Layout Method</h1>
<div id="summary"></div>
CSS
/* top box */
.summary-top-box{
border: solid 1px #cccccc;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 0px;
border-bottom-right-radius: 0px;
padding: 7px;
margin-top: 15px;
font-weight: bold;
font-size: 1.5em;
background: #f5f5f5; /* Old browsers */
background: -moz-linear-gradient(top, #f5f5f5 0%, #ffffff 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f5f5f5 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f5f5f5 0%,#ffffff 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #f5f5f5 0%,#ffffff 100%); /* IE10+ */
background: linear-gradient(to bottom, #f5f5f5 0%,#ffffff 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
}
/* middle box */
.summary-middle-box{
border: solid 1px #cccccc;
border-top: solid 0 #cccccc;
clear: both;
height: auto;
overflow: hidden;
}
.summary-middle-box div{
border-right: solid 1px #cccccc;
width: 16.6666%; /* fallback for browsers without support for calc() */
width: -moz-calc(100% / 6); /* Gecko 2.0 (Firefox 4) and above, experimental, will be dropped */
width: -webkit-calc(100%/ 6); /* WebKit 536.3 (Chrome 19) and above, experimental */
width: calc(100%/ 6); /* final CSS3 compliant implementation; Firefox 16 and IE 9, and above */
float: left;
margin-right:-1px;
margin-bottom: -99999px;
padding-bottom: 99999px;
}
.summary-middle-box div:last-child{
border-right: none;
}
.summary-middle-box div ul {
list-style: none;
margin:5px;
padding:0;
}
.summary-middle-box div ul li{
margin:0;
padding:0;
}
.summary-middle-box div ul li:first-child{
display: block;
font-weight: bold;
font-size: 1.4em;
}
/* bottom box */
.summary-bottom-box{
border: solid...
JavaScript
var summary = (function () {
function summary (container){
// define variables
var d = document,
obj,
boxTop,
boxMiddle,
div,
ul,
li;
// get required style sheets if we don't have them
// get the required javascript if we dont' have them
// get object
// summary-top-box
boxTop = createElement('div', d.getElementById(container), 'summary-top-box');
boxTop.innerHTML = 'Summary';
// summary-middle-box
boxMiddle = createElement('div', d.getElementById(container), 'summary-middle-box');
// current status
div = createElement('div', boxMiddle);
ul = createElement('ul', div);
li = createElement('li', ul);
li.innerHTML = 'Active';
li = createElement('li', ul);
li.innerHTML = 'Status';
// total exposed votes
div = createElement('div', boxMiddle);
ul = createElement('ul', div);
li = createElement('li', ul);
li.innerHTML = '333';
li = createElement('li', ul);
li.innerHTML = 'Some Value';
// total control votes
div = createElement('div', boxMiddle);
ul = createElement('ul', div);
li = createElement('li', ul);
li.innerHTML = '100';
li = createElement('li', ul);
li.innerHTML = 'Some Value';
// total votes
div = createElement('div', boxMiddle);
ul = createElement('ul', div);
li = createElement('li', ul);
li.innerHTML = '433';
li = createElement('li', ul);
li.innerHTML = 'Total Value';
// total unique viewers
div = createElement('div', boxMiddle);
ul = createElement('ul', div);
li = createElement('li', ul);
li.innerHTML = '--';
li = createElement('li', ul);
li.innerHTML = 'Some Other Value';
// viewable impressions
div = createElement('div', boxMiddle);
ul = createElement('ul', div);
li = createElement('li', ul);
li.innerHTML = '--';
li = createElement('li', ul);
li.innerHTML = 'Some Final Value';
// summary-bottom-box
boxMiddle = createElement('div', d.getElementById(container), 'summary-bottom-box');
// column 1
div =...