Giter Site home page Giter Site logo

flexy-griddy's Introduction

html, css
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            padding : 20px;
            text-align: center;
        }
        .grid-container {
            display: grid;
            grid-template: repeat(4, 1fr) / repeat(8, 1fr); 
            gap: 1rem;
        }
        .grid-container div {
            background-color: skyblue;
            padding: 40px;
            border: 1px solid black;
        }
        .item-1 {
            grid-column-start: 1;
            grid-column: span 8;
        }
        .item-2 {
            grid-column: 1 / 2;
        }
        .item-3 {
            grid-column: 2 / 7;
        }
        .item-4 {
            grid-column: 7 / 9;
        }
        .item-5 {
            grid-column: 1 / 5;
        }
        .item-6 {
            grid-column: 5 / 9;
        }
        .item-7 {
            grid-column-start: 1;
            grid-column: span 8;
        }
    </style>
</head>
<body>
    <div class="grid-container">
        <div class="item-1">1</div>
        <div class="item-2">2</div>
        <div class="item-3">3</div>
        <div class="item-4">4</div>
        <div class="item-5">5</div>
        <div class="item-6">6</div>
        <div class="item-7">7</div>
    </div>
</body>
</html>

html, css
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            padding : 20px;
            text-align: center;
        }
        .grid-container {
            display: grid;
            grid-template: repeat(4, 1fr) / repeat(4, 1fr); 
            gap: 1rem;
        }
        .grid-container div {
            background-color: skyblue;
            padding: 40px;
            border: 1px solid black;
        }
        .item-1 {
            grid-column: 1/2;
            grid-row: 1/3;

        }
        .item-2 {
            grid-column: 2/5;

        }
        .item-3 {
            grid-column: 2/4;
            grid-row: 2/4;
        }
        .item-4 {
            grid-column: 4/5;
        }
        .item-5 {
        }
        .item-6 {

        }
        .item-7 {
            grid-column: 1/3;
        }
        .item-8 {
            grid-column: 3/5;
        }
    </style>
</head>
<body>
    <div class="grid-container">
        <div class="item-1">1</div>
        <div class="item-2">2</div>
        <div class="item-3">3</div>
        <div class="item-4">4</div>
        <div class="item-5">5</div>
        <div class="item-6">6</div>
        <div class="item-7">7</div>
        <div class="item-8">8</div>
    </div>
</body>
</html>

html, css
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      padding: 30px;
    }
    .grid {
      display: grid;
      margin: 10px;
      grid-gap: 1rem;
      grid-template: repeat(4, 1fr) / repeat(4, 1fr);
    }
    .grid div{
      background-color: skyblue;
      padding: 40px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .item-1 {
      grid-column: 1 / 4;
    }
    .item-2 {
      grid-column: 4 / 5;
      grid-row: 1 / 4;
    }
    .item-3 {
      grid-column: 2 / 4;
      grid-row: 2 / 4;
    }
    .item-4 {
      grid-column: 1 / 2;
      grid-row: 2 / 5;
    }
    .item-5 {
      grid-column: 2 / 5;
    }
  </style>
</head>
<body>
  <div class="grid">
    <div class="item-1">1</div>
    <div class="item-2">2</div>
    <div class="item-3">3</div>
    <div class="item-4">4</div>
    <div class="item-5">5</div>

  </div>
</body>
</html>

flex1 (1)

answer
<!DOCTYPE html>
<html>
  <head>
    <style>
    .flex {
      display: flex;
      text-align: center;
      gap: 10px;
    }
    .flex div {
      background-color: skyblue;
      padding: 10px;
    }
    .first {
      flex: 0 0 100px;
    }
    .second {
      flex: 1 1 auto;
    }
    .third {
      flex: 0 0 100px;
    }
    </style>
  </head>
<body>
  <div class="flex">
    <div class="first">1</div>
    <div class="second">2</div>
    <div class="third">3</div>
  </div>
</body>
</html>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.