Dear all, I would like to have a 3 column layout, and semantically my markup makes sense from a content point of view:
<!-- 1. main-->
<div>
<div class="product"></div>
<div class="product"></div>
<div class="product"></div>
<div class="product"></div>
</div>
<!-- 2. side bar -->
<div>
</div>
<!-- 3. other info -->
<div>
</div>
I am looking to style the above layout of the main column containing a sub 2 column layout of products, and the sidebar, so it would like like 3 columns, with the products stacked 2 wide in the main div.
I have created some bootstrap code and have the following questions please:
- When the below code is ran, why is the other div at the end offset to the left and how do i fix this?
- Ideally i want to keep the html as clean as possible (not adding arbitrary rows/columns) but what is the cleanest way to make the product divs stack side by side 2-wide (equal width each), and collapse on top of one another when the browser width reduces?
Code is below
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled 1</title>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<style type="text/css">
div {
border: 1px solid blue;
}
</style>
</head>
<body>
<div class='container'>
<h1></h1>
<div class='navbar navbar-inverse'>
<div class='navbar-inner nav-collapse' style="height: auto;">
<ul class="nav">
</ul>
</div>
</div>
<div id='content' class='row-fluid'>
<div id='main' class='span9'>
<h2>Main</h2>
<div class="product">
<p>Item 1</p>
</div>
<div class="product">
<p>Item 2</p>
</div>
<div class="product">
<p>Item 3</p>
</div>
<div class="product">
<p>Item 4</p>
</div>
</div>
<div id='sidebar' class='span3'>
<h2>Side</h2>
</div>
<div id='other' class="row">
<div class="span12">
<p>other details here</p>
</div>
</div>
</div>
</div>
</body>
</html>