Forum Moderators: not2easy
A row of inline-block: would be another possible option, but you would have to keep an especially close eye on IE.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body {
margin: 0; padding: 0; font-size: 100%;
}#center-wrapper {
position: relative;
}#first, #second, #third {
width: 30%;
border: .1em solid #000;
}#first {
position: absolute; top: 0; left: 0;
}#second {
position: absolute; top: 0; left: 50%; margin-left: -15%;
}#third {
position: absolute; top: 0; right: 0;
}</style>
</head>
<body>
<div id="center-wrapper">
<div id="first">
FIRST BLOCK
<br />
FIRST BLOCK
<br />
FIRST BLOCK
<br />
FIRST BLOCK
<br />
</div>
<div id="second">
SECOND BLOCK
<br />
SECOND BLOCK
<br />
SECOND BLOCK
<br />
SECOND BLOCK
<br />
</div>
<div id="third">
THRID BLOCK
<br />
THRID BLOCK
<br />
THRID BLOCK
<br />
THRID BLOCK
<br />
</div>
</div>
<!--##########-->
</body>
</html>
Are all block elements that are side by side - next to each other or on same line - or columns- floated or is there another way to do this?
There are probably half a dozen ways to get blocks next to one another:
- floats, although I often feel it's a bit over-used.
- absolute positioning: you can put them *anywhere*, hence also next to one another
- relative positioning: you can nudge elements to move to where you want them
- inline-blocks: they are blocks but they are also inline elements
- display: table-* : makes your elements act as if they are elements in a table.
- CSS3 multiple columns
- ... (did I miss any)?
Which is best will depend a lot on what's in them and around them.