vendredi 19 octobre 2018

How to make a CSS-Grid System based on Papernorm DIN-A

I want to make a DIN-A Grid and fill them with Text and Images. Its important that the Grid is based on the DIN-A Norm.

I tried it and it kinda works. Problem is, when I reduce the browser height, the Boxes change in proportion.

Im not sure if its even possible to achieve a responsive Layout like this. Also important, the content of the boxes should not force the box to be bigger. I will make the content smaller instead. Only exeption is the Grid-Cell "A1" at the bottom. This one should/can expand to infinity.

Any ideas how to achieve this?

Here is the Code: https://codepen.io/anon/pen/PyedKo

HTML

<div id="wrapper">
    <body>
        <main>
            <div class='grid1'>
                <div class="A1">
                    <h6> A1 </h6>
                </div>
                <div class="A2">
                    <h6> A2 </h6>
                </div>
                <div class='grid2'>
                    <div class="A3">
                        <h6> A3 </h6>
                    </div>
                    <div class="A4">
                        <h6> A4 </h6> <br><br>
                    </div>
                    <div class='grid3'>
                        <div class="A5">
                            <h6> A5 </h6> <br>
                        </div>
                        <div class="A6">
                            <h6> A6 </h6> <br>
                        </div>
                        <div class='grid4'>
                            <div class="A7">
                                <h6> A7 </h6> <br>
                            </div>
                            <div class="A8">
                                <h6> A8 </h6>
                            </div>
                            <div class="empty">
                                <p>
                                    <h6> A8 </h6>
                                 </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
</div>
</div>
</main>
</div id="wrapper">
</body>

CSS

:root {
--background-color: rgba(250,250,250,1);
}

* {
box-sizing: border-box;
padding: 0;
margin: 0;
outline: 0;
border: 0;
}

body {
background-color: rgba(0, 255, 0, 0.1)
}

#wrapper {
display: flex;
justify-content: center;
align-items: center;
height: auto;
width: 100vw;
}

h1, h2, h3, h4, h5, h6, p {
font-family: "Roboto", sans-serif;
}

h6 {
color: grey;
font-weight: 400;
margin-bottom: 20px;
padding-bottom: 5px;
float: left;
border-bottom: 1px solid grey;
width: 100%;
}

main {
width: 100vh;
height: 141vh;
}

.grid1, .grid2, .grid3, .grid4 {
height: 100%;
width: 100%;
display: grid;
grid-gap: 5px;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
grid-template-areas:
"tleft bleft"
"bottom bottom";
}


.A1 {
grid-area: bottom;
background-color: var(--background-color);
border: 1px solid lightgrey;
padding: 15px;
}

.A2 {
grid-area: tleft;
background-color: var(--background-color);
border: 1px solid lightgrey;
padding: 15px;
}

.A3 {
grid-area: bottom;
background-color: var(--background-color);
border: 1px solid lightgrey;
padding: 15px;
}

.A4 {
grid-area: tleft;
background-color: var(--background-color);
border: 1px solid lightgrey;
padding: 15px;
}

.A5 {
grid-area: bottom;
background-color: var(--background-color);
border: 1px solid lightgrey;
padding: 10px;
}

.A6 {
grid-area: tleft;
background-color: var(--background-color);
border: 1px solid lightgrey;
padding: 10px;
}

.A7 {
grid-area: bottom;
background-color: var(--background-color);
border: 1px solid lightgrey;
padding: 5px;
}

.A8 {
grid-area: tleft;
background-color: var(--background-color);
border: 1px solid lightgrey;
padding: 5px;
}

.empty {
grid-area: bleft;
background-color: var(--background-color);
border: 1px solid lightgrey;
padding: 5px;
}




Aucun commentaire:

Enregistrer un commentaire