Reputation: 463
i need to make something like this:
I am not 100% sure how to make this so i decide for table which can be usefull, but it just terrible scatter what i did, my try looks like:
<table>
<tr>
<td rowspan="2" class="img-position"><a href="#"><img src="images/foto.png"></a></td>
<td class="topic-name"><a href="#">Název topicu nebo článku </a></td>
<td class="date">28.8.2014 / 19:30</td>
</tr>
</table>
My CSS:
#sub-content .left{
width: 326px;
height: 145px;
display: inline-block;
float:left;
}
#sub-content img{
width: 122px;
height: 121px;
display: inline-block;
margin-top: 0px;
margin-left: 5px;
}
#sub-content .topic-name{
width: 150px;
height: 14px;
line-height 14px;
margin-bottom: 130px;
margin-left: 10px;
display: inline-block;
vertical-align: top;
text-decoration: underline;
font-weight: 14px;
}
#sub-content table{
width:326px;
height:145px;
}
#sub-content tr{
margin: 10px 0px 0px 0px;
padding: 0px;
height: 36px;
}
#sub-content .date{
}
#sub-content .img-position{
margin: 0px;
padding: 0px;
width: 122px;
height: 121px;
display: inline-block;
}
And i cant move from my position to style atleast one of that part and then just copy it 3 times. I hope i find somebody here who can help me to fix it.
Live preview can be found on: http://funedit.com/andurit/try1/
Thanks for reading my post
Upvotes: 0
Views: 101
Reputation: 2246
Use bootstrap grids, to achieve tabular style. It's responsive and easy to implement. Include this CSS file.
<div class='row'>
<div class='col-xs-4 tab'> <!-- 1/3rd size of the parent container -->
<div class='row'>
<!-- Image box -->
<div class='col-xs-4'>
<a href="#"><img src="images/foto.png"></a>
</div>
<!-- Description box -->
<div class='col-xs-8'> <!-- 2/3rd size of parent container -->
<div><a href="#">Název topicu nebo článku </a></div>
<div>28.8.2014 / 19:30</div>
<div>Lorem Ipsum</div>
</div>
</div>
</div>
<div class='col-xs-4 tab'> <!-- 1/3rd size of the parent container -->
<div class='row'>
<!-- Image box -->
<!-- ... Follow same structure as above-->
</div>
</div>
<div class='col-xs-4 tab'> <!-- 1/3rd size of the parent container -->
<div class='row'>
<!-- ... Follow same structure as above -->
</div>
</div>
</div>
This will give you 3 columns, in a row of equal width. For fixed height of each tab, just provide
<style>
.tab{
height: 200px;
}
</style>
For implementation details, See here.
Upvotes: 0
Reputation: 2789
First of all I recommend you to read this : Why not use tables for layout in HTML? its about how you should not create your layout.
I prepared you basic jsfiddle example with your given stuff to make you catch up on things faster. Check this out. Example layout
I changed your given layout to divs and spans and it would look more or less like this:
<div class='article-container'>
<div class='article'>
<div class="img-position">
<a href="#"><img src="http://funedit.com/andurit/try1/images/foto.png"/></a>
</div>
<span class="topic-name"><a href="#">Název topicu nebo článku </a></span>
<span class="date">28.8.2014 / 19:30</span>
</div>
.
.
.
</div>
Upvotes: 1
Reputation: 1203
Doing this in tables NON Semantic and I not recommend it. For my opinion you need to use this structure
Html
<div class="block1">block1</div>
<div class="block2">block2</div>
<div class="block3">block3</div>
</div>
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
width: 100%;
}
.wrapper{
width: 100%;
background: #ddd;
}
.block1{
float: left;
width: 33.3%;
background: #c01;
height: 200px;
margin-right: 1px;
}
.block2{
float: left;
width: 33.3%;
background: #c01;
height: 200px;
margin-right: 1px;
}
.block3{
float: left;
width: 33.3%;
background: #c01;
height: 200px;
}
Upvotes: 0