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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <main>
  
  <h1>A Venn Diagram</h1>

  <article class="Venn xmas">
    <h2>&#8746; of Christmas Traditions</h2>
    <div class="circle one" tabindex="0" role="region" aria-labelledby="C1">
      <span></span>
      <span></span>
      <h3 id="C1">Christian</h3>
      <ul>
        <li>Baby Jesus</li>
        <li>Angels</li>
        <li>Carols</li>
        <li>9 Lessons &amp; carols</li>
        <li>Christingle</li>
        <li>Nativity plays</li>
        <li>The Magi</li>
        <li>Midnight Mass</li>
        <li>Bells</li>
        <li>Star of Bethlehem</li>
        <li>Advent calendars</li>
        <li>Cliff Richard</li>
      </ul>
    </div>
    <div class="circle two" tabindex="0" role="region" aria-labelledby="C2">
      <span></span>
      <span></span>
      <h3 id="C2">Secular</h3>
      <ul>
        <li>Magenbrot</li>
        <li>Snow globes</li>
        <li>Christmas cards</li>
        <li>Snowman</li>
        <li>Reindeer</li>
        <li>Plum pudding</li>
        <li>Eggnog</li>
        <li>The RI Christmas Lectures</li>
        <li>Slade</li>
        <li>Tinsel</li>
        <li><i>Die Hard</i></li>
        <li>Pantomime</li>
        <li>Christmas jumpers</li>
        <li>The Pogues and Kirsty MacColl</li>
        <li><i>Dr. Who</i> Christmas special</li>
        <!--
      <li>White wine in the sun</li>-->
      </ul>
    </div>
    <div class="circle three" tabindex="0" role="region" aria-labelledby="C3">
      <span></span>
      <span></span>
      <h3 id="C3">Pagan</h3>
      <ul>
        <li>Yule logs</li>
        <li>Feasting</li>
        <li>Solstice</li>
        <li>Wreaths</li>
        <li>Mumming</li>
        <li>Wassailing</li>
        <li>Mistletoe</li>
        <li>Holly &amp; Ivy</li>
      </ul>
    </div>
    <div class="shape onetwo">
      <span></span>
      <span></span>
      <h3>Christian + Secular</h3>
      <ul>
        <li>Mince Pies</li>
        <li>The 12 Days of Christmas</li>
        <li>Candy Canes</li>
      </ul>
    </div>
    <div class="shape onethree">
      <span></span>
      <span></span>
      <h3>Christian + Pagan</h3>
      <ul>
        <li>Candles</li>
        <li>Christmas trees</li>
        <li>Virgin births</li>
      </ul>
    </div>
    <div class="shape twothree">
      <span></span>
      <span></span>
      <h3>Secular + Pagan</h3>
      <ul>
        <li>Christmas crackers</li>
        <li>Boxing Day</li>
        <li>Gift giving</li>
      </ul>
    </div>
    <div class="shape onetwothree">
      <span></span>
      <span></span>
      <h3>Christian + Pagan + Secular</h3>
      <ul>
        <li>Saint Nicholas / Father Christmas / Santa Claus</li>
      </ul>
    </div>
  </article>

  <div>
    <h2>Background</h2>
    <p>
      This is an accessible version of the image at <i>The Reason Stick</i>’s article <cite><a href="https://crispian-jago.blogspot.com.au/2013/12/the-venn-diagram-of-christmas-traditions.html?m=1">The Venn Diagram of Christmas Traditions</a></cite>. I have a blog post explaining the code: <cite><a href="http://adrianroselli.com/2018/12/a-css-venn-diagram.html">A CSS Venn Diagram</a></cite>
    </p>
  </div>
 
</main>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Amiri:400,400i,700");

:root {
  --venn-width-mult: 0.92;
}

body {
  font-family: "Amiri", serif;
  /*   font-size: calc(.55em + 1vw); */
  background-color: #fff;
  background: repeating-linear-gradient(
    135deg,
    #c12a2a,
    #c12a2a 2vw,
    #0cc700 2vw,
    #0cc700 4vw
  );
  margin: 0;
  color: #333;
  font-size: 140%;
}

main > * {
  width: calc(100% * var(--venn-width-mult));
  margin: 0 auto;
}

main > div {
  box-sizing: border-box;
  background-color: rgba(255, 255, 255, 0.9);
  margin: 1.5em auto;
  padding: 1em 2em;
  border-radius: 2em;
}

h1,
h2,
h3 {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  line-height: 1.1;
  font-family: Arial, "San Francisco", serif;
}

h1 {
  clip-path: inset(100%);
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  width: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}

h2 {
  font-size: 125%;
}

a,
a:link,
a:visited,
a:active {
  color: rgb(5, 0, 61);
}

a:hover,
a:focus {
  color: rgba(5, 0, 61, 0.5);
}

/* Start Venn */

/* :root {
	--venn-width-mult: 0.9;
} */

/* Defaults for browsers that do not support shape-outside */
@media (min-width: 800px) {
	.Venn::after {
		content: "";
		display: block;
		width: 1px;
		height: 1px;
		clear: both;
	}

	.circle,
	.shape {
		box-sizing: border-box;
		border: 0.1em solid rgba(0, 0, 0, 0.5);
		margin: 0 0.75%;
		padding: 0 1.5em;
		float: left;
		width: 32%;
	}

	.circle.one {
		margin-left: 0;
	}

	.circle.three {
		margin-right: 0;
	}

	.shape {
		width: 30%;
		margin: 1em 1%;
	}

	.shape.onetwo {
		margin-left: 2.5%;
		clear: left;
		border-top-right-radius: 1em;
	}

	.shape.twothree {
		margin-right: 2.5%;
		border-top-left-radius: 1em;
	}

	.shape.onethree {
		margin-top: 3em;
		border-top-right-radius: 1em;
		border-top-left-radius: 1em;
	}

	.shape.onetwothree {
		clear: both;
		width: 40%;
		margin-left: 30%;
		margin-right: 30%;
		border-radius: 1.5em;
	}
}

@supports (shape-outside: polygon(0 0, 0 50%, 50% 50%)) {
	.Venn::after {
		display: none;
	}

	.Venn > div {
		box-sizing: border-box;
		border: 0.1em solid rgba(0, 0, 0, 0.5);
		font-size: calc(2.5vw * var(--venn-width-mult));
		line-height: 1.3;
		overflow: hidden;
	}

	.Venn > .shape {
		font-size: calc(2.25vw * var(--venn-width-mult));
		border: initial;
		width: initial;
		margin: initial;
		padding: initial;
	}

	.Venn > .circle {
		border-radius: 50%;
		width: initial;
		margin: initial;
		padding: initial;
	}

	/* Grid layout  */
	.Venn {
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		grid-template-rows: repeat(3, calc(28.8vw * var(--venn-width-mult)));
	}

	.Venn > h2 {
		grid-column-start: 1;
		grid-column-end: 6;
		grid-row-start: 0;
		grid-row-end: 1;
	}

	.Venn > .circle.one {
		/*   outline: .2em solid #f00; */
		grid-column-start: 1;
		grid-column-end: 4;
		grid-row-start: 1;
		grid-row-end: 3;
	}

	.Venn > .circle.two {
		/*   outline: .2em solid #0f0; */
		grid-column-start: 3;
		grid-column-end: 6;
		grid-row-start: 1;
		grid-row-end: 3;
	}

	.Venn > .circle.three {
		/*   outline: .2em solid #00f; */
		grid-column-start: 2;
		grid-column-end: 5;
		grid-row-start: 2;
		grid-row-end: 4;
	}

	.Venn > .shape.onetwo {
		/*   outline: .2em solid #ff0; */
		grid-column-start: 3;
		grid-column-end: 4;
		grid-row-start: 1;
		grid-row-end: 2;
	}

	.Venn > .shape.onethree {
		/*   outline: .2em solid #f0f; */
		grid-column-start: 2;
		grid-column-end: 4;
		grid-row-start: 2;
		grid-row-end: 2;
	}

	.Venn > .shape.twothree {
		/*   outline: .2em solid #0ff; */
		grid-column-start: 3;
		grid-column-end: 5;
		grid-row-start: 2;
		grid-row-end: 2;
	}

	.Venn > .shape.onetwothree {
		/*   outline: .2em solid #fff; */
		grid-column-start: 3;
		grid-column-end: 3;
		grid-row-start: 2;
		grid-row-end: 2;
	}

	/* Text wrap */
	.Venn .circle,
	.Venn .shape {
		text-align: center;
	}
	.Venn .circle span,
	.Venn .shape span {
		box-sizing: border-box;
		float: right;
		/*     border: 1px dotted #00f;
    background-color: rgba(0,0,0,.1); */
	}
	.Venn .circle > span {
		width: calc(58.5vw * var(--venn-width-mult));
		height: calc(58.5vw * var(--venn-width-mult));
	}
	.Venn .shape > span {
		height: calc(29vw * var(--venn-width-mult));
	}
	.Venn .one > span {
		float: left;
		width: 32%;
		shape-margin: 0;
		shape-outside: polygon(
			100% 0%,
			0% 0%,
			0% 100%,
			100% 100%,
			100% 92%,
			76% 88%,
			44% 80%,
			20% 70%,
			10% 60%,
			5% 50%,
			10% 40%,
			20% 30%,
			41% 20%,
			70% 10%,
			100% 5%
		);
	}
	.Venn .one > span + span {
		float: right;
		width: 66%;
		shape-outside: polygon(
			100% 0%,
			40% 0%,
			65% 15%,
			53% 25%,
			47% 35%,
			44% 45%,
			43% 50%,
			31% 55%,
			12% 65%,
			5% 75%,
			0% 85%,
			0% 100%,
			100% 100%
		);
	}
	.Venn .two > span {
		float: left;
		width: 66%;
		shape-margin: 0;
		shape-outside: polygon(
			0% 0%,
			60% 0%,
			35% 15%,
			47% 25%,
			53% 35%,
			56% 45%,
			57% 50%,
			69% 55%,
			88% 65%,
			95% 75%,
			100% 85%,
			100% 100%,
			0% 100%
		);
	}
	.Venn .two > span + span {
		float: right;
		width: 32%;
		shape-outside: polygon(
			0% 0%,
			100% 0%,
			100% 100%,
			0% 100%,
			0% 92%,
			24% 88%,
			56% 80%,
			80% 70%,
			90% 60%,
			95% 50%,
			90% 40%,
			80% 30%,
			59% 20%,
			30% 10%,
			0% 5%
		);
	}
	.Venn .three > span {
		float: left;
		width: 49%;
		shape-margin: 0;
		shape-outside: polygon(
			0% 0%,
			100% 0%,
			100% 40%,
			75% 47%,
			50% 50%,
			2% 50%,
			5% 60%,
			13% 70%,
			27% 80%,
			52% 90%,
			78% 95%,
			100% 97%,
			100% 100%,
			0% 100%
		);
	}
	.Venn .three > span + span {
		float: right;
		shape-outside: polygon(
			100% 0%,
			0% 0%,
			0% 40%,
			25% 47%,
			50% 50%,
			98% 50%,
			95% 60%,
			87% 70%,
			73% 80%,
			48% 90%,
			22% 95%,
			0% 97%,
			0% 100%,
			100% 100%
		);
	}
	.Venn .onetwo > span {
		float: left;
		width: 49%;
		shape-margin: 0;
		shape-outside: polygon(
			0% 0%,
			100% 0%,
			100% 30%,
			72% 40%,
			48% 50%,
			20% 70%,
			10% 85%,
			0% 98%,
			100% 98%,
			100% 100%,
			0% 100%
		);
	}
	.Venn .onetwo > span + span {
		float: right;
		shape-outside: polygon(
			100% 0%,
			0% 0%,
			0% 30%,
			28% 40%,
			52% 50%,
			80% 70%,
			90% 85%,
			100% 98%,
			0% 98%,
			0% 100%,
			100% 100%
		);
	}
	.Venn .onethree > span {
		float: left;
		width: 48%;
		shape-margin: 0;
		shape-outside: polygon(
			0% 0%,
			100% 0%,
			100% 5%,
			70% 20%,
			45% 35%,
			26% 50%,
			10% 75%,
			5% 90%,
			50% 98%,
			100% 95%,
			100% 100%,
			0% 100%
		);
	}
	.Venn .onethree > span + span {
		float: right;
		width: 51%;
		shape-outside: polygon(
			100% 0%,
			0% 0%,
			0% 25%,
			9% 40%,
			20% 55%,
			40% 70%,
			30% 80%,
			0% 90%,
			0% 100%,
			100% 100%
		);
	}
	.Venn .twothree > span {
		float: left;
		width: 51%;
		shape-margin: 0;
		shape-outside: polygon(
			0% 0%,
			100% 0%,
			100% 25%,
			91% 40%,
			80% 55%,
			60% 70%,
			70% 80%,
			100% 90%,
			100% 100%,
			0% 100%
		);
	}
	.Venn .twothree > span + span {
		float: right;
		width: 48%;
		shape-outside: polygon(
			100% 0%,
			0% 0%,
			0% 5%,
			30% 20%,
			55% 35%,
			74% 50%,
			90% 75%,
			95% 90%,
			50% 98%,
			0% 95%,
			0% 100%,
			100% 100%
		);
	}
	.Venn .onetwothree > span {
		float: left;
		width: 49%;
		shape-margin: 0;
		shape-outside: polygon(
			0% 0%,
			10% 15%,
			30% 35%,
			50% 50%,
			95% 70%,
			100% 100%,
			0% 100%
		);
	}
	.Venn .onetwothree > span + span {
		float: right;
		shape-outside: polygon(
			100% 0%,
			90% 15%,
			70% 35%,
			50% 50%,
			5% 70%,
			0% 100%,
			100% 100%
		);
	}
	.Venn .circle h3 {
		margin: 0.5em 0 0 0;
		text-align: center;
	}
	.Venn .circle h3 + * {
		margin-top: 0.2em;
	}
	.Venn .shape h3 {
		clip-path: inset(100%);
		clip: rect(1px, 1px, 1px, 1px);
		height: 1px;
		width: 1px;
		overflow: hidden;
		position: absolute;
		white-space: nowrap;
	}
}


/* End Venn */

/* Custom styles */

/* .xmas {
  --venn-width-mult: .90;
} */

.xmas {
  width: calc(100% * var(--venn-width-mult));
  margin: 0 auto;
}

.xmas * {
  transition: all .15s ease-in;
}

.xmas h2 {
  color: #000;
  line-height: 1.1;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 2em;
  text-align: center;
  padding: 0.5em 1em;
}

.xmas .onetwo {
  background-color: rgba(255, 255, 230, 0.85);
}

.xmas .twothree {
  background-color: rgba(230, 255, 255, 0.85);
}

.xmas .onethree {
  background-color: rgba(255, 230, 255, 0.85);
}

.xmas .onetwothree {
  background-color: rgba(255, 255, 255, 0.85);
}

@media screen and (max-width: 799px) {
  .xmas .circle, .xmas .shape {
    padding: 1em 2em;
  }
}

@supports (shape-outside: polygon(0 0, 0 50%, 50% 50%)) {
  .xmas ul,
  .xmas li {
    list-style: none;
    margin: 0;
    padding: 0;
    display: inline;
  }

  .xmas ul {
    display: block;
  }

  .xmas li:not(:last-child)::after {
    content: ", ";
  }

  .xmas li:last-child::after {
    content: ". ";
  }

  .xmas > div {
    font-size: calc(2.75vw * var(--venn-width-mult));
  }

  .xmas > .shape {
    font-size: calc(2.35vw * var(--venn-width-mult));
    z-index: 1;
  }
  
  .xmas .circle, .xmas .shape {
    padding: initial;
  }

  .xmas .onetwothree ul {
    margin-top: 0.9em;
  }

  .xmas .onethree,
  .xmas .twothree {
    font-size: calc(2.75vw * var(--venn-width-mult));
  }
  
  .xmas .one > span {
    shape-margin: .6em;
  }
  
  .xmas .three > span {
    shape-margin: 1.75em;
  }

  .xmas .circle ul {
    margin: 0.5em 0 0 0;
  }
  
  .xmas .one h3 {
    margin-top: 2.75em;
  }
  
  .xmas .two h3 {
    margin-top: 1.25em;
  }

  .xmas .shape {
    background-color: transparent
  }
}

.xmas .one {
  background-color: rgba(255, 230, 230, 0.85);
  border-color: rgba(255,255,255,1);
}

.xmas .one:hover,
.xmas .one:focus {
  background-color: rgba(204, 0, 0, 1);
  border-color: rgba(255,0,0,1);
}

.xmas .two {
  background-color: rgba(230, 255, 230, 0.85);
  border-color: rgba(255,255,255,1);
}

.xmas .two:hover,
.xmas .two:focus {
  background-color: rgba(0, 153, 0, 1);
  border-color: rgba(0,255,0,1);
}

.xmas .three {
  background-color: rgba(230, 230, 255, 0.85);
  border-color: rgba(255,255,255,1);
}

.xmas .three:hover,
.xmas .three:focus {
  background-color: rgba(0, 0, 204, 1);
  border-color: rgba(0,0,255,1);
}

.xmas .circle:hover,
.xmas .circle:focus {
  z-index: 2;
  box-shadow: -1em 1em 1.5em rgba(0, 0, 0, 0.5),
    inset 0 0 0.5em rgba(255, 255, 255, 1);
  color: #fff;
  outline: none;
  overflow: hidden;
}

.xmas .circle {
  position: relative;
}

.xmas .circle:hover::before,
.xmas .circle:focus::before {
  content: "";
  position: absolute;
  background: radial-gradient(
    circle at 50% 120%,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0) 70%
  );
  border-radius: 50%;
  bottom: 2.5%;
  left: 5%;
  opacity: 0.6;
  height: 100%;
  width: 90%;
  filter: blur(0.7em);
  /*   z-index: 2; */
}
.xmas .circle:hover::after,
.xmas .circle:focus::after {
  content: "";
  width: 100%;
  height: 100%;
  position: absolute;
  top: 5%;
  left: 10%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.65) 14%,
    rgba(255, 255, 255, 0) 24%
  );
  transform: translateX(10%) translateY(-35%) skewX(20deg);
  filter: blur(1.5em);
}

.xmas:hover > div, .xmas:focus-within > div {
    overflow: visible;
}

@media print {
  :root {
  --venn-width-mult: 1;
  }
  body {
    background: none;
    background-color: #fff;
    color: #000;
  }
  .xmas .circle, .xmas .shape {
    background-color: transparent;
  }
  main > div {
    padding: 0;
  }
  .xmas .one, .xmas .two, .xmas .three {
      border-color: rgba(0,0,0,1);
  }
}
              
            
!

JS

              
                  
              
            
!
999px

Console