News for hackers. Stuff that matters.
Re:Hexagons and Beyond: Flexible, Responsive Grid Patterns, ... by airstrike on Thursday March 20, 2025 @03:42PM (#43427951)
> This is a fully responsive hexagon grid made without media queries, JavaScript, or a ton of hacky CSS.

the CSS:

    .main {
      display:flex;
      --s: 100px;  /* size  */
      --m: 4px;    /* margin */
      --f: calc(1.732 * var(--s) + 4 * var(--m)  - 1px);
    }

    .container {
      font-size: 0; /*disable white space between inline block element */
    }

    .container div {
      width: var(--s);
      margin: var(--m);
      height: calc(var(--s)*1.1547); 
      display: inline-block;
      font-size:initial;
      clip-path: polygon(0% 25%, 0% 75%, 50% 100%, 100% 75%, 100% 25%, 50% 0%);
      background: red;
      margin-bottom: calc(var(--m) - var(--s)*0.2885); 
    }
    .container div:nth-child(odd) {
      background:green;
    }
    .container::before {
      content: "";
      width: calc(var(--s)/2 + var(--m));
      float: left;
      height: 120%;
      shape-outside: repeating-linear-gradient(     
                       #0000 0 calc(var(--f) - 3px),      
                       #000  0 var(--f));
    }
Re:Hexagons and Beyond: Flexible, Responsive Grid Patterns, ... by Muromec on Thursday March 20, 2025 @06:28PM (#43429751)
It's some 100% of hacky CSS all right.
Re:Hexagons and Beyond: Flexible, Responsive Grid Patterns, ... by afiori on Friday March 21, 2025 @08:08AM (#43434658)
It is hacky but not a ton