Also, I would like to center verticaly and horizontally things inside div. I tried, but nothing worked for me. I tried, adding absolute position. Then I can set width and height normally, but then I have problems width text(s) inside div: I cant center it vertically
Here is simple code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<style>
.Table{
background-color:red;
display:table;
height:400px;
width:300px;
}
.Row1{
background-color:blue;
display:table-row;
text-align:center;
vertical-align:middle;
width:20px;
height:100px;
position:relative;
}
</style>
<div class="Table">
<div class="Row1">
<p>Row1</p>
<!--<div class="Cell1"></div>
<div class="Cell2"></div>
<div class="Cell3"></div>-->
</div>
<div class="Row2">
<p>Test</p>
</div>
</div>
</body>
</html>
I think one solution is: Display inner div again as table, then set paragraph as table-cell. After that, I can easy center things using align-text or vertically-align. Also I can easily set width and height of this div.