Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>CSS rendering of a <a href="https://www.internationalposter.com/media/48639/swx25214z.jpg" target="_blank">Richard Paul Lohse poster</a> </h1>

<div class="poster ">
  <div class="art">
  <div class="hexagon hexagon--black "></div>
  <div class="hexagon hexagon--white "></div>
  <div class="hexagon hexagon--white "></div>
  <div class="hexagon hexagon--blue"></div>
  <div class="hexagon hexagon--red"></div> 
 <div class="hexagon hexagon--black"></div>
  <div class="hexagon hexagon--black"></div>
  <div class="hexagon hexagon--red hexagon--withTxt">
    
   <div class="poster__txt--main">
    
       <h2 class="poster__title">Kunststoffe</h2>
      <h3 class="poster__copy">Synthetische Materialism und livr Arwendung in</h3>
      <ul class="poster__themes">
        <li>Architektur</li>
        <li>Haushalt</li>
        <li>Technische Gebiete</li>
        <li>Sport</li>
        <li>Verkehr</li>      
      </ul> 
    </div>
  </div>
  <div class="hexagon hexagon--red"></div>
 <div class="hexagon hexagon--blue"></div>
  <div class="hexagon hexagon--white hexagon--withTxt">
    <ul class="poster__txt--details">
    <li class="museum">Gewerbemuseum Wintertur</li>
     <li>27 septemeber bus 9 November 1958</li>
     <li>Werkstags 14 bis 18 Uhr.</li>
     <li>Samtstags 14 bis 17 Uhr.</li>
     <li>Samtstags 14 bis 18 und 14 bis 17 Uhr.</li>
     <li>Mittwoch und Freitag auch 19 bis 21 Uhr.</li>
   </ul>
    </div>
  <div class="hexagon hexagon--black"></div>
   <div class="hexagon hexagon--white"></div>
  <div class="hexagon hexagon--black"></div>
  <div class="hexagon hexagon--white "></div>
   
 
    </div>
</div>

<p class="desc">After seeing <a href="https://www.youtube.com/watch?v=p7oXrr9yjXY" target="_blank">CSS Grid talk</a>  by <a href="https://twitter.com/diana_aceves_" target="_blank">Diana Aceves </a>I decided to learn CSSgrid by making the same kind of examples.</p>
<p class="desc">In this case I did use css Grid for the background pattern. I tried to overlay the text elements using grid-area, but it didn't work, so I had to place them inside the correspondent grid element.</p>
<p class="desc">I dont understand the reasons behind the glitches in some hexagons, as in <a href="https://codepen.io/turuto/pen/yjeKqg" target="_blank">this another pen</a>, you can see this method is quite robust.</p>
<p class="desc">It still needs to be made a SASS mixin for the trasform rules of the rows.</p>
<p class="desc">The typography is placed roughly, so it doesn't match the original. And about the german.... Well. I couldn't find a source with enough pixels to read the text.....</p>

              
            
!

CSS

              
                :root{
  --tam:60ch;
  --w:25rem;
  --ratio:1.732; //Basic Trigonometry. Explained in  http://shariarbd.com/2014/07/css-hexagon-ratio-of-height-width/
  --h:calc(var(--w) / var(--ratio));
  --itemW: calc( var(--w) / 2);
  --itemH:calc( var(--itemW) / var(--ratio) );
  --halfW:calc(var(--itemW) /2 );
 --halfH:calc(var(--itemH) /2 );
 
  --white:#d9d6cf;
  --black:#000a17;
  --grey:#282828; 
  --red:#be413b;
  --blue:blue; //don't care. It's a flag
   --cyan:#00a0c9;
  --magenta:#de0872;
  --yellow:#ddad3b;  
}
/*PURE COSMETIC CSS, MOVE DOWN TO THE .poster SELECTOR*/
body{
  font-family: 'Helvetica', sans-serif;
  background: var(--grey);
  color:var(--white);
}
h1 {
  text-align: center;
}
a:link, a:visited {
  color: var(--yellow);
  text-decoration: none;
  transition:0.4s ease-out color; 
}
a:hover, a:active, a:focus{
   color: var(--cyan);
}
.desc{
  max-width: calc(var(--tam) * 1.4);
  margin: 0 auto;
  margin-bottom: 1em;
}
.note {
  margin-top: 3em;
  font-size: 0.9em;
  color: #5fd0a1;
  font-style: italic;
}

/*ACTUAL POSTER*/
.poster{
  color:var(--black); 
  width: var(--w);
  height:calc(var(--itemH) *5 );
  box-shadow:0 0 5px rgba(0,0,0,.5);
  margin: 2em auto;
  overflow:hidden; 
}

.art {
  display: grid;
  grid-template-columns:repeat(3 , var(--itemW));
  grid-template-rows:repeat(5,  var(--itemH));
  transform:translate(calc(var(--itemW) / -2), calc(var(--itemH) *-1));
 }
.hexagon{
  height: calc(var(--itemW) /var(--ratio));
 background: var(--myColor);
 position: relative;  
  &:before, &:after {
    content:'';   
    position: absolute;   
    border: calc(var(--itemW) / 2) solid transparent;
  }
  &:before{
    border-top:none; 
    border-bottom: calc(var(--itemH) / 2) solid var(--myColor);
    transform:translateY(-100%);
  }
  &:after{
    border-top: none;
    border-bottom: calc(var(--itemH) / 2) solid  var(--myColor);
    transform: translateY(var(--itemH)) rotate(180deg)
  }
  &--black{ --myColor: var(--black);};
  &--red{ --myColor: var(--red);};
  &--white{ --myColor: var(--white);};
  &--blue{ --myColor: var(--blue);
  opacity: 0;};
}

.hexagon{
  &:nth-child(4), &:nth-child(5),&:nth-child(6) {
      transform:translate(calc(var(--halfW)*-1), var( --halfH));
     }
  &:nth-child(7), &:nth-child(8),&:nth-child(9) {  
  transform:translate(0 , calc(var( --halfH) * 2) );
  }
   &:nth-child(10), &:nth-child(11),&:nth-child(12) {  
  transform:translate(calc(var(--halfW)*-1), calc(var( --halfH) * 3) );
   }
   &:nth-child(13), &:nth-child(14),&:nth-child(15) {  
  transform:translate(0, calc(var( --halfH) * 4) );
  }
}
.hexagon--withTxt{
  overflow: visible;
  z-index: 1;
}
.poster__txt--main{
  position: absolute;
 
  left: 50%;
  width: var(--itemW);
  z-index: 2;
}
.poster__title{
  margin: 0;
  padding: 0;
  font-size: 2.2em;
 // outline:1px solid yellow;
  line-height: 0.8;
  margin-top: 0.2em;
}
.poster__copy{
  font-size: 0.2em;
  margin-top: 0.1em;
}
.poster__themes{
  list-style: none;
  margin:0px;
  margin-top: 1em;
  padding: 0;
  font-weight: bold;
  font-size: 0.9rem;
  
}
.poster__txt--details{
  --gap:2%;
  overflow: hidden;
 // outline:1px solid blue;
  list-style: none;
  width: calc(var(--halfW) - var(--gap));
  margin: 0;
  padding: 0;
  font-size: 0.02em;
   position: absolute;
  left: var(--gap);
  z-index: 2;
  font-weight: bold;
}
.museum{
 font-size: 0.7rem;
  margin-bottom: 0.5em
}
              
            
!

JS

              
                
              
            
!
999px

Console