Make a table of div with images and text

时间:2016-10-20 12:50:35

标签: javascript html css css-tables

I did a div table with 3 image with text for each row, the problem is that I can't make all the div that contains text at the same size, how can I do that? I have to put this table at the centre of the screen, I did this with padding attribute, there is a more efficient way?

1 个答案:

答案 0 :(得分:0)

make all the div that contains text at the same size

add a class to the div's containing text and set the height and width in css like this:

HTML: <div class="textDiv">texttexttext</div>

CSS: .textDiv {height: 150px; width: 150px;}

put this table at the centre of the screen

create a container for your divs (you probably already have one) add a class to it like this:

HTML: <div class="divContainer">

than set the margin to auto and a width if you need one:

CSS: .divContainer {margin: auto; width: 50%;}