PDA

View Full Version : Putting two, or more, images side by side.



Syncopator
Mar 3rd, 2010, 11:01 PM
Is there any way other than using a table to place images side by side?

skywalker2208
Mar 3rd, 2010, 11:29 PM
Take a look at
http://robertnyman.com/2010/02/24/css-display-inline-block-why-it-rocks-and-why-it-sucks/

Excavator
Mar 4th, 2010, 01:17 AM
Hello Syncopator,
If you just leave them alone they line up side by side on their own...
Replace backall.jpg in this code with one of your own and see -
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
html, body {
font: 100% "Comic Sans MS";
background: #FC6;
}
* {
margin: 0;
padding: 0;
border: 0;
}
#container {
width: 800px;
margin: 30px auto;
background: #999;
}
</style>
</head>
<body>
<div id="container">
<img src="backall.jpg" width="150" height="150" alt="pink and blue" />
<img src="backall.jpg" width="150" height="150" alt="pink and blue" />
<img src="backall.jpg" width="150" height="150" alt="pink and blue" />
<img src="backall.jpg" width="150" height="150" alt="pink and blue" />
<img src="backall.jpg" width="150" height="150" alt="pink and blue" />
<img src="backall.jpg" width="150" height="150" alt="pink and blue" />
<!--end container--></div>
</body>
</html>


It could be you're looking for something a little more elegant. I have a thumbnail presentaion method demo you might be able to copy - http://nopeople.com/CSS/thumbnail%20presentation/index.html

And there's nothing wrong with just floating a couple images either.

Good for you for wanting to avoid tables :thumbsup: - pictures are not usually tabular data.