I found a solution on this site to center a div between two floats . The solution works fine except that I have a double border now.
CSS
.trilink_container {
margin:5px;
overflow: hidden; /* contain floated elements */
}
.trilink_all {
border: 1px solid #CCCCCC;
color: #444444;
text-shadow: 0 1px 1px #F6F6F6;
background: #fdfdfd;
background: -o-linear-gradient(top, #fdfdfd, #eee);
background: -ms-linear-gradient(top, #fdfdfd, #eee);
background: -moz-linear-gradient(top, #fdfdfd, #eee);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fdfdfd), color-stop(1, #eee));
background: -webkit-linear-gradient(#fdfdfd, #eee);
background: linear-gradient(top, #fdfdfd, #eee);
text-align:center;
}
.trilink_item {
float: left;
width: 32%;
margin-left:5px;
}
.trilink_right {
float: right;
width: 32%;
margin-right:5px;
}
.trilink_center {
margin-left: auto;
margin-right: auto;
}
HTML
<div class="trilink_container">
<div class="trilink_item trilink_all">Left Test</div>
<div class="trilink_right trilink_all">Right Text</div>
<div class="trilink_center trilink_all">Centre Text</div>
</div>
I've also added the code to jfiddle.
BTW, I realise my coding is a bit messy and intend to tidy it up once I have a solution :)
Any ideas?