Without relying on tables, what would be a good solution to accomplish a tile layout such as this: that automatically adapts to the screen size of the user. That is, the whole screen should be filled by the tiles, regardless of the with and height of the resolution.
I appreciate any ideas.
~ Robert
To make an HTML element behave as a grid container, you have to set the display property to grid or inline-grid . Grid containers consist of grid items, placed inside columns and rows.
You can use javascript to make the cells respond onclick. Alternatively, you can use the a tag behave as a grid, by adding display:block to your . box style class and provide any other css attributes needed. The caveat is that you won't be able to nest other elements inside your a tags.
CSS Grid Layout is a two-dimensional layout system for the web. It lets you lay content out in rows and columns, and has many features that make building complex layouts straightforward. This article will give you all you need to know to get started with page layout, then test your grid skills before moving on.
CSS cards are great for organizing and enhancing a website's user interface. Each card is uniquely designed to make it easy for users to read the card content. CSS cards are great for organizing and enhancing a website's user interface. Each card is uniquely designed to make it easy for users to read the card content.
Here is a working example: jsfiddle
Html:
<div class="container">
<div class="first">first</div><div class="third">third</div>
<div class="second">second</div><div class="fourth">fourth</div><div class="last">last</div>
</div>
CSS:
html, body, .container
{
height: 100%;
min-height: 100%;
}
.first {
float: left;
width: 20%;
height: 30%;
background-color: red;
}
.second{
float: left;
width: 20%;
height: 70%;
background-color: green;
}
.third{
float: right;
width: 80%;
height: 80%;
background-color: blue;
}
.fourth {
float: right;
width: 40%;
height: 20%;
background-color: #DDDDDD;
}
.last{
float: right;
width: 40%;
height: 20%;
background-color: yellow;
}
I would go with some div
using absolute positionning. And specify for each tile the width/height/top/left using %
unit.
Hint:
With this three point, you should be able to try yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With