
previous

page 5
next
Obviously all the images are going to be fitted to the grid in our game container so, instead of typing height:100% for every image, we can specify it just once as shown below. So here is what we have so far:
index.html
<body>
<div id='game'>
<img src='images/scenes/3.jpg' id='scene'>
<img src='images/shapes/blue.png' id='blue'>
</div>
</body>
<div id='game'>
<img src='images/scenes/3.jpg' id='scene'>
<img src='images/shapes/blue.png' id='blue'>
</div>
</body>
styles.css
img {
height: 100%;
}
#game {
width: 120vmin;
height: 90vmin;
display: grid;
grid-template-rows: repeat(10,10%);
grid-template-columns: repeat(10,10%);
}
#scene {
grid-row: 1 / span 10;
grid-column: 1 / span 10;
}
#blue {
grid-row: 8 / span 3;
grid-column: 6 / span 2;
}
height: 100%;
}
#game {
width: 120vmin;
height: 90vmin;
display: grid;
grid-template-rows: repeat(10,10%);
grid-template-columns: repeat(10,10%);
}
#scene {
grid-row: 1 / span 10;
grid-column: 1 / span 10;
}
#blue {
grid-row: 8 / span 3;
grid-column: 6 / span 2;
}
previous
next