This is surprisingly hard to find out how to do. All solutions I've found so far have been wrong. Here's my problem:
I have a table in a div:
<div id="dishreel">
<table>
<tr>
</tr>
</table>
</div>
And I'm putting images inside it:
for(var i=0; i<allDishes.length; i++){
var td = document.createElement("td");
var img = document.createElement("img");
img.classList.add("dishimg");
img.src = "images/"+allDishes[i].image;
var p = document.createElement("p");
var text = document.createTextNode(allDishes[i].name);
p.appendChild(text);
td.append(img);
td.append(p);
dishreel.find("tr").append(td);
}
All of the dishes end up on a row, like this:
This is what I want. Now, I want the row of dishes to be in the middle of the div, vertically. So a row in the middle of the page in this case, since the div is taking up all of the page, because of my css:
#dishreel{
height:100%;
width:100%;
}
I've tried to use flexbox, it didn't change anything:
#dishreel{
height:100%;
width:100%;
display:flex;
flex-direction: column;
justify-content: center;
}
Does somebody know how to get this to work?