Frank Vel Frank Vel - 4 months ago 5x
CSS Question

Make a grid of divs floated right with parent table div the size of its children

This is my failed attempt:

I want the block on the right side and the extra gray part gone.


float: right;

To the parent makes its children very small and tiny. If I try to widen the children by adding

width: 50%;

They break the line.

Is there a simple fix?

(Also I think

margin-top: 1px;

Isn't working?)

Thanks in advance


A better way is to use a table:




table {
    border-collapse: collapse;
    background: #000;
    border-top: 1px solid #777;
    border-left: 1px solid #777;

table tr td {
    border-right: 1px solid #777;
    border-bottom: 1px solid #777;
    color: #fff;