FLABS-HH
Explore different ways to align/arrange elements in columns in html
Block level elements normally start (and end) with a new line, when displayed in a browser.
Example
Inline elements are normally displayed without line breaks.
Example
align 3 <div>
's in a 3 columns layout.
div {
width: 100px;
height: 100px;
border-radius: 6px;
}
.red { background-color: #d02b41; }
.yellow { background-color: #ffcc52; }
.blue { background-color: #42afb7; }
div {
...
float: left;
}
div {
...
float: right;
}
div {
...
float: left;
}
.footer {
width: 300px;
background-color: #1a1a1a;
}
.footer {
width: 300px;
background-color: #1a1a1a;
float: none;
}
.footer
is not floated anymore, but the div
's are overlapped
.footer {
width: 300px;
background-color: #1a1a1a;
float: none;
clear: left;
}
.box {
width: 100px;
height: 100px;
border-radius: 6px;
float: left;
}
.container {
background-color: #1a1a1a;
padding: 5px;
border-radius: 6px;
}
.clearfix:after {
content: ".";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
wrapp boxes in a <div>
.table {
display: table;
}
.column {
display: table-cell;
}
a wrapping container has to be defined!
Set vertical alignment
.column {
...
vertical-align: middle;
}
set fix table layout and define the width of table
box1
box2 contains.some.more....
box3
...
.table {
...
table-layout: fixed;
width: 500px;
}
have a look into:
everything you know abut CSS is wrong!
[rachel andrew]