Reputation: 1489
I have this Table.
With this HTML
<div class="list-item">
<p>
<input type="checkbox">
<span class="list-type"><img src="/images/types/{{this.type}}.png" title="{{this.type}}" /></span>
<span class="list-title">{{this.title}}</span>
<span class="list-owner">{{this.owner}}</span>
<span class="list-date">16 Dec 2014</span>
</p>
</div><br>
With this CSS
.list-item{
display: inline-block;
width: 100%;
border: solid 1px #dddddd;
}
.list-type{
margin-left: 10px;
margin-right: 10px;
}
But i want to create something like a table inside the <div>
.
NOTE I KNOW that a <table>
fits perfect, but for how this content is beign created i need to simulate a table with this <div>
, so table unforntannly its not an option here.
I need to replicate something like this (check image).
NOTE ignore the Star icon
Settin margin-left
to each of the <span>
but the order of the "admin" and "date" are not equals, if i use margins i get this (check image).
Im getting this with this CSS
.list-item{
display: inline-block;
width: 100%;
border: solid 1px #dddddd;
}
.list-type{
margin-left: 10px;
}
.list-title{
margin-left: 10px;
}
.list-owner{
margin-left: 100px;
}
.list-date{
margin-left: 190px;
}
Upvotes: 3
Views: 72
Reputation: 459
I have changed some Tags and some CSS, I like the use of percentage width and divs. If this does not help you maybe it can give you more ideas.
.list-item{
display: inline-block;
width: 100%;
border: solid 1px #dddddd;
}
.cb{
float: left;
width:3%;
}
.list-type{
float: left;
width:8%;
}
.list-title{
float:left;
width:35%;
}
.list-owner{
float:left;
width:15%;
}
.list-date{
float: left;
width: 20%;
}
<div class="list-item">
<p>
<input type="checkbox" class="cb">
<div class="list-type"><img src="/images/types/{{this.type}}.png" title="{{this.type}}" /></div>
<div class="list-title">Title</div>
<div class="list-owner">Owner</div>
<div class="list-date">16 Dec 2014</div>
</p>
</div><br>
<div class="list-item">
<p>
<input type="checkbox" class="cb">
<div class="list-type"><img src="/images/types/{{this.type}}.png" title="{{this.type}}" /></div>
<div class="list-title">Title22</div>
<div class="list-owner">Owner22</div>
<div class="list-date">16 Dec 201422</div>
</p>
</div><br>
<div class="list-item">
<p>
<input type="checkbox" class="cb">
<div class="list-type"><img src="/images/types/{{this.type}}.png" title="{{this.type}}" /></div>
<div class="list-title">Title 333</div>
<div class="list-owner">Owner 333</div>
<div class="list-date">16 Dec 2014333</div>
</p>
</div>
Did this help???
Upvotes: 2
Reputation: 378
Try with the below css:
.list-title{ margin-left: 10px; width: 200px;}
.list-owner{ margin-left: 10px; width: 40px;}
.list-date{ margin-left: 10px; width: 40px;}
Note: Change the width size according to your need.
Upvotes: 1
Reputation: 1039
Tabular data: use tables.
Or as @oriol suggested, use CSS tables.
Upvotes: -2
Reputation: 287990
Try CSS tables:
.list-item {
display: table;
}
.list-item > p {
display: table-row;
}
.list-item > p > * {
display: table-cell;
}
Upvotes: 3