How to fix a 3x3 block of images with CSS - html

I have a 3x3 block of images.
I want the images to be 400px wide and 300px in height.
I also want the images to stretch from edge to edge of the screen and for there to be no space between the images.
This is what it looks like at the moment
This is my current CSS and HTML:
.clear {
clear: both;
}
#grid {
width: 100%;
}
.grid-element {
width: 33.3333%;
height: 200px;
float: left;
}
<div id="grid">
<div class="grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
</div>
<div class="clear">Example taken from grandoch's gist</div>

E. Updated the answer for use with Bootstrap.
Bootstrap adds left and right padding for all col-*-* elements, so you will merely need to remove that padding.
For full viewport width, you will need to use a fluid container, i.e. the container-fluid class.
#grid .grid-element {
height: 200px;
padding-left: 0px;
padding-right: 0px;
overflow: hidden;
}
img {
width: 100%;
height: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div id="grid" class="row">
<div class="col-xs-4 grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="col-xs-4 grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="col-xs-4 grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="col-xs-4 grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="col-xs-4 grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="col-xs-4 grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="col-xs-4 grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="col-xs-4 grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
<div class="col-xs-4 grid-element">
<img src="http://static.caloriecount.about.com/images/medium/colby-cheese-157898.jpg" />
</div>
</div>
</div>

Related

How do I create a grid-styled layout without grid or flexbox?

I want to create a grid styled layout without using grid or flexbox. I am assuming I need float for this. One of the issues is that the images aren't' filling the entire space. Any advice on how to do this?
.container {
max-width: 90%;
margin: 0 auto;
}
.grid-item {
width: 25%;
float: left;
}
.grid-item img {
object-fit: cover;
width: 100%;
height: auto;
}
<div class="container">
<div class="grid">
<div class="grid-item phone">
<img src="https://picsum.photos/500/300" alt="" />
</div>
<div class="grid-item camera">
<img src="https://picsum.photos/400/200" alt="" />
</div>
<div class="grid-item watch">
<img src="https://picsum.photos/500/300" alt="" />
</div>
<div class="grid-item camera">
<img src="https://picsum.photos/400/200" alt="" />
</div>
<div class="grid-item watch">
<img src="https://picsum.photos/500/300" alt="" />
</div>
<div class="grid-item camera">
<img src="https://picsum.photos/400/200" alt="" />
</div>
<div class="grid-item watch">
<img src="https://picsum.photos/500/300" alt="" />
</div>
</div>
</div>
I suggest using the columns rule, specifying the number of columns and a width of 1/4 of the total width for responsiveness:
columns: 4 25vh;
Thus, the template with the image is now responsive without media queries.
.container {
max-width: 90%;
margin: 0 auto;
}
.grid {
columns: 4 25vh;
}
.grid-item {
/*width: 25%;
float: left;*/
}
.grid-item img {
object-fit: cover;
width: 100%;
height: auto;
}
<div class="container">
<div class="grid">
<div class="grid-item phone">
<img src="https://picsum.photos/500/300" alt="" />
</div>
<div class="grid-item camera">
<img src="https://picsum.photos/400/200" alt="" />
</div>
<div class="grid-item watch">
<img src="https://picsum.photos/500/300" alt="" />
</div>
<div class="grid-item camera">
<img src="https://picsum.photos/400/200" alt="" />
</div>
<div class="grid-item watch">
<img src="https://picsum.photos/500/300" alt="" />
</div>
<div class="grid-item camera">
<img src="https://picsum.photos/400/200" alt="" />
</div>
<div class="grid-item watch">
<img src="https://picsum.photos/500/300" alt="" />
</div>
</div>
</div>

How to set child div 100% height of the parent (Foundation 6)?

There are three 33% divs next to eachother. The 1st is an empty div, the 2nd a div containing four images, and the 3rd empty div.
How do I responsively keep these 3 blocks the same height? I'm using Foundation 6.
.block {
background: grey;
}
.block, .imgBlock {
height: 200px;
}
.imgBlock .row .column{
padding: 0;
}
<link href="https://cdn.jsdelivr.net/foundation/6.2.0/foundation.min.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.2.3/foundation.min.js"></script>
<div class="row small-up-3">
<div class="column block">
</div>
<div class="column imgBlock">
<div class="row small-up-2">
<div class="column">
<img src="http://placekitten.com/200/150"/>
</div>
<div class="column">
<img src="http://placekitten.com/200/150"/>
</div>
<div class="column">
<img src="http://placekitten.com/200/150"/>
</div>
<div class="column">
<img src="http://placekitten.com/200/150"/>
</div>
</div>
</div>
<div class="column block">
</div>
</div>
Use foundation equalizer js. Here is your code using foundation equalizer:
Code:
$(document).foundation();
.block {
background: grey;
}
.block,
.imgBlock {
height: 200px;
}
.imgBlock .row .column {
padding: 0;
}
<link href="https://cdn.jsdelivr.net/foundation/6.2.0/foundation.min.css" rel="stylesheet" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.2.3/foundation.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.2.3/plugins/foundation.equalizer.js"></script>
<div class="row small-up-3" data-equalizer>
<div class="column block" data-equalizer-watch>
</div>
<div class="column imgBlock" data-equalizer-watch>
<div class="row small-up-2">
<div class="column">
<img src="http://placekitten.com/200/150" />
</div>
<div class="column">
<img src="http://placekitten.com/200/150" />
</div>
<div class="column">
<img src="http://placekitten.com/200/150" />
</div>
<div class="column">
<img src="http://placekitten.com/200/150" />
</div>
</div>
</div>
<div class="column block" data-equalizer-watch>
</div>
</div>

How to make the grid system centered horizontally?

I want to get the grid system to center but it won't, i was thinking maybe it has something to do with my pictures' border?. here's the screen shotwhat it is right now
what i want it to be
HTML:
<div class=" container">
<div class="row">
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
</div>
</div>
CSS:
.optionBorder
{
border: 1px solid #f5f5f5;
height: 130px;
width: 130px;
line-height: 130px;
text-align: center;
}
Take another element before row with some width and make them center
for example.:
HTML
<div class="test">
<div class="row">
<div class="col-md-4">
<div class="optionBorder">
<img src="http://placehold.it/350x150" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="http://placehold.it/350x150" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="http://placehold.it/350x150" height="74px" width="50px">
</div>
</div>
</div>
</div>
CSS
.test {
width: 450px;
margin: auto;
margin-bottom: 15px;
}
bootply
<style>
.paraentCont{
width:100%;
max-width:300px;
margin:auto;
}
</style>
<div class=" container">
<div class="paraentCont">
<div class="row">
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
</div>
Give to .row fixed width such as 700px, and margin-left/right auto
look at this example http://www.bootply.com/GFDHc6p5tg
Actually here is there right way to go while using Bootsrap
Use the predefine class text-center
Use q Bootstrap helper like .inline-block{display: inline-block}
.inline-block{display: inline-block}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class=" container">
<div class="row text-center">
<div class="col-md-4 inline-block">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4 inline-block">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4 inline-block">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
</div>
</div>

how to create space between the images?

I am getting my head around bootstrap 3 , html5 and css3. Trying to build a page containing a few images:
.front {
margin: 3px;
padding: 3px;
}
img {
height: 300px;
}
<div class="form-group">
<div class="col-lg-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
</div>
Question: how can I display the images adding some space (margin, padding) between them? I tried to set the margin/padding for the img css rule:
here is a link to the code:https://github.com/dimster2013/soccerapp/commit/f9bde7aafbcffffabc9b034b66ee25440ea5f6aa
Add Below CSS
.col-sm-3 .front img {
padding: 10px 5px 5px 10px !important;
width:100%!important;
}
.col-sm-3{
padding:0px!important;
}
<div class="form-group">
<div class="col-lg-3 col-sm-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi">
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi">
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi">
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi">
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi">
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi">
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi">
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi">
</div>
</div>
</div>
If you have a look at your markup, you are using div elements with class col-lg-3 in which house your img tags.
By placing:
.col-lg-3 {
display: inline-block;
margin: 3px;
padding: 3px;
}
on this div class instead, it should work for you.
The reason your images are displaying one per line is due to div elements being display: block declaration by default. Overriding this by setting inline-block would allow multiple images per line (if screen width permits).
A quick demo would be:
img {
height: 300px;
}
.col-lg-3 {
display: inline-block;
margin: 3px;
padding: 3px;
}
<div class="form-group">
<div class="col-lg-3">
<div class="front">
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
<div class="col-lg-3">
<div>
<img src="https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRE1_PJ6L1IQVa2v6Xd1G7vypRQbQmCKGTq0TkMNJmMHFPm-hvKYA" alt="messi" />
</div>
</div>
</div>
One way is to add a margin to div (col-lg-3) containing the images - this rule could look similar to this:
.col-lg-3 {
margin-bottom: 40px;
}
That will add space between the images as you asked for. It will still display all images underneath each other, not on the same line; other answers to your question explain why.

How to align div objects in rows

I wanna align my six div objects, which are basicly boxes, into three rows.
(picture i draw to demonstrate >
I'm really clueless how i should align my boxes, so that they come ento these rows.
Right now, it's just one long horizontal line.
I'll post my code here :)
HTML:
<div class="boxbox">
<div id="newsb">
<img class="bottom" src="news/newsbutton.png" />
<img class="topi" src="news/news2.png" />
</div>
<div id="billetb">
<img class="bottom" src="news/billetbutton.png" />
<img class="topi" src="news/billetbutton2.png" />
</div>
<div id="infob">
<img class="bottom" src="news/infobutton.png" />
<img src="news/infobutton2.png" width="250" height="150" class="topi" />
</div>
<div id="kontak">
<img class="bottom" src="news/kontakt.png" />
<img class="topi" src="news/kontakt2.png" />
</div>
<div id="log">
<img class="bottom" src="news/loginbutton.png" />
<img class="topi" src="news/login2.png" />
</div>
<div id="cf4a">
<img class="bottomi" src="news/sponsor/KS.png" />
<img class="topi" src="news/sponsor/SS.png" />
<img class="bottomi" src="news/sponsor/ES.png" />
<img class="topi" src="news/sponsor/CM.png" />
</div>
</div>
CSS:
This is basicly just hover over animations, it'll be way to long to post here. Please write if you will need my CSS.
Any help would be greatly appreciated!
According to the picture, here's the code:
Live demo
HTML
<div class="boxbox">
<div class="row">
<div id="newsb">
<img class="bottom" src="news/newsbutton.png" />
<img class="topi" src="news/news2.png" />
</div>
<div id="billetb">
<img class="bottom" src="news/billetbutton.png" />
<img class="topi" src="news/billetbutton2.png" />
</div>
<div id="infob">
<img class="bottom" src="news/infobutton.png" />
<img src="news/infobutton2.png" width="250" height="150" class="topi" />
</div>
</div>
<div class="row">
<div id="kontak">
<img class="bottom" src="news/kontakt.png" />
<img class="topi" src="news/kontakt2.png" />
</div>
<div id="log">
<img class="bottom" src="news/loginbutton.png" />
<img class="topi" src="news/login2.png" />
</div>
<div id="cf4a">
<img class="bottomi" src="news/sponsor/KS.png" />
<img class="topi" src="news/sponsor/SS.png" />
<img class="bottomi" src="news/sponsor/ES.png" />
<img class="topi" src="news/sponsor/CM.png" />
</div>
</div>
</div>
CSS
.row{
display:block;
}
.row div{
display:inline;
}
You can see this here:
HTML:
<div class="boxbox">
<div id="newsb">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="billetb">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="infob">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="kontak">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="log">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
<div id="cf4a">
<img class="left" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
<img class="right" src="http://a.deviantart.net/avatars/v/a/varezart.jpg?1" />
</div>
CSS:
.boxbox {
height:200px;
margin:10px;
}
.boxbox > div {
width:32%;
height:100px;
background-color:Black;
display:inline-block;
margin:1px;
}
* {
margin:0;
padding:0;
}
.left {
float:left;
}
.right {
float:right;
}
img {
margin-top: 12px;
}
You cansee this here: http://jsfiddle.net/78UEX/1/
Hope this helps!!!
Try this demo ..
You can let each div take its place by it-self, and if the horizontal row has no place for another div, it will go to another row under the first row ..
<style>
.boxbox{
position: relative;
}
.box{
float: left;
width: 33.3%;
}
</style>
<div class="boxbox">
<div id="newsb" class="box">
<img class="bottom" src="news/newsbutton.png" />
<img class="topi" src="news/news2.png" />
</div>
<div id="billetb" class="box">
<img class="bottom" src="news/billetbutton.png" />
<img class="topi" src="news/billetbutton2.png" />
</div>
<div id="infob" class="box">
<img class="bottom" src="news/infobutton.png" />
<img src="news/infobutton2.png" />
</div>
<div id="kontak" class="box">
<img class="bottom" src="news/kontakt.png" />
<img class="topi" src="news/kontakt2.png" />
</div>
<div id="log" class="box">
<img class="bottom" src="news/loginbutton.png" />
<img class="topi" src="news/login2.png" />
</div>
<div id="cf4a" class="box">
<img class="bottomi" src="news/sponsor/KS.png" />
<img class="topi" src="news/sponsor/SS.png" />
<img class="bottomi" src="news/sponsor/ES.png" />
<img class="topi" src="news/sponsor/CM.png" />
</div>
</div>
Another way
demo
or you can set three vertical rows and put two divs in each row ..
<style>
.boxbox{
position: relative;
overflow: hidden;
}
.row{
float: left;
width: 33.3%;
}
</style>
<div class="boxbox">
<div class="row">
<div id="newsb">
<img class="bottom" src="news/newsbutton.png" />
<img class="topi" src="news/news2.png" />
</div>
<div id="billetb">
<img class="bottom" src="news/billetbutton.png" />
<img class="topi" src="news/billetbutton2.png" />
</div>
</div>
<div class="row">
<div id="infob">
<img class="bottom" src="news/infobutton.png" />
<img src="news/infobutton2.png" />
</div>
<div id="kontak">
<img class="bottom" src="news/kontakt.png" />
<img class="topi" src="news/kontakt2.png" />
</div>
</div>
<div class="row">
<div id="log">
<img class="bottom" src="news/loginbutton.png" />
<img class="topi" src="news/login2.png" />
</div>
<div id="cf4a">
<img class="bottomi" src="news/sponsor/KS.png" />
<img class="topi" src="news/sponsor/SS.png" />
<img class="bottomi" src="news/sponsor/ES.png" />
<img class="topi" src="news/sponsor/CM.png" />
</div>
</div>
</div>
According to your picture, you want 2 Rows of 3 Columns. Rows go left/right and Columns go up/down.
There are many different ways to do this.
Here's an example: http://jsfiddle.net/qB55N/
<div class='row'>
<div class='col'>1</div>
<div class='col'>2</div>
<div class='col'>3</div>
</div>
<div class='row'>
<div class='col'>4</div>
<div class='col'>5</div>
<div class='col'>6</div>
</div>
Is this what you are talking about? Example: http://jsfiddle.net/xsZ54/
HTML
<div class="row">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
</div>
<div class="row">
<div class="box">4</div>
<div class="box">5</div>
<div class="box">6</div>
</div>
CSS:
.row{
display: table;
width: 100%;
}
.box{
display: table-cell;
}