HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs 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 its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<html>
<head><title>Shared cM Project</title>
</head>
<body>
<h1>The Shared cM Project – Version 3.0</h1>
<div class="meta-left">
<h2>August 2017</h2>
<p>Blaine T. Bettinger</p>
<p>www.thegeneticgenealogist.com</p>
<p><a target="background" href="http://www.thegeneticgenealogist.com/2015/05/29/the-shared-cm-project/">More about this project</a></p>
<p><a target="license" href="https://creativecommons.org/licenses/by/4.0/">CC 4.0 Attribution License</a></p>
<p>Interactive version by Jonny Perl at <a target="dnapainter" href="/">DNA Painter</a>
</div>
<div class="meta-middle">
<h3>Filter</h3>
<label for="compare">Enter the number of cM for your match here:</label>
<input type="number" id="compare" max="3720" width="8" />
<a href="#" class="reset">reset</a>
<br style="clear:both" />
<br style="clear:both" />
<label>Then any relationships that fit will stand out below</label>
<a href="https://dnapainter.com/tools/sharedcm/" id="currentamount">Click here for a sharable link to the cM amount above</a>
</div>
<div id="key">
<h3>How to read this chart</h3>
<ul>
<li>
<div><strong>Relationship</strong><span>Average</span><span>Range<br />(low to high)</span></div>
</li>
</ul>
</div>
<ul class="rels">
<li class="clear pad8 span2">
<div><strong>Great-Great-Grandparent</strong></div>
</li>
<li>
<div><strong>GGGG Aunt/Uncle</strong></div>
</li>
<li class="clear pad7 span2">
<div><strong>Great-Great-Grandparent</strong></div>
</li>
<li>
<div><strong>GGG Aunt/Uncle</strong></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="clear r3" data-start="12" data-end="383">
<div><strong>Half GG-Aunt/Uncle</strong><span>187</span><span>12 – 383</span></div>
</li>
<li class="span7 r2" data-start="464" data-end="1486">
<div><strong>Great-Grandparent</strong><span>881</span><span>464 – 1486</span></div>
</li>
<li class="c3" data-start="191" data-end="885">
<div><strong>Great-Great Aunt/Uncle</strong><span>427</span><span>191 – 885</span></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="other">
<div><strong>Other Relationships</strong></div>
</li>
<li class="clear dotted">
<div></div>
</li>
<li class="r2" data-start="125" data-end="765">
<div><strong>Half-Great Aunt / Uncle</strong><span>432</span><span>125 – 765</span></div>
</li>
<li class="span5 r1" data-start="1156" data-end="2311">
<div><strong>Grandparent</strong><span>1766</span><span>1156 – 2311</span></div>
</li>
<li class="r2" data-start="251" data-end="2108">
<div><strong>Great Aunt/Uncle</strong><span>914</span><span>251 – 2108</span></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="other" data-start="0" data-end="86">
<div><strong>6C</strong><span>21</span><span>0 – 86</span></div>
</li>
<li class="clear dotted">
<div></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="r1" data-start="500" data-end="1446">
<div><strong>Half Aunt/Uncle</strong><span>891</span><span>500 – 1446</span></div>
</li>
<li class="span3 r0" data-start="3330" data-end="3720">
<div><strong>Parent</strong><span>3487</span><span>3330 – 3720</span></div>
</li>
<li class="r1" data-start="1349" data-end="2175">
<div><strong>Aunt/Uncle</strong><span>1750</span><span>1349 – 2175</span></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="dotted">
<div></div>
</li>
<li class="other" data-start="0" data-end="72">
<div><strong>6C1R</strong><span>16</span><span>0 – 72</span></div>
</li>
<li class="clear r3" data-start="0" data-end="178">
<div><strong>Half 3C</strong><span>61</span><span>0 – 178</span></div>
</li>
<li class="r2" data-start="9" data-end="397">
<div><strong>Half 2C</strong><span>117</span><span>9 – 397</span></div>
</li>
<li class="r1" data-start="137" data-end="856">
<div><strong>Half 1C</strong><span>457</span><span>137 – 856</span></div>
</li>
<li class="r0" data-start="1317" data-end="2312">
<div><strong>Half-Sibling</strong><span>1783</span><span>1317 – 2312</span></div>
</li>
<li class="r0" data-start="2209" data-end="3384">
<div><strong>Sibling</strong><span>2629</span><span>2209 – 3384</span></div>
</li>
<li class="other">
<div><strong>SELF</strong></div>
</li>
<li class="r1" data-start="553" data-end="1225">
<div><strong>1C</strong><span>874</span><span>553 – 1225</span></div>
</li>
<li class="r2" data-start="46" data-end="515">
<div><strong>2C</strong><span>233</span><span>46 – 515</span></div>
</li>
<li class="c3" data-start="0" data-end="217">
<div><strong>3C</strong><span>74</span><span>0 – 217</span></div>
</li>
<li class="r4" data-start="0" data-end="217">
<div><strong>4C</strong><span>35</span><span>0 – 217</span></div>
</li>
<li class="r5" data-start="0" data-end="94">
<div><strong>5C</strong><span>25</span><span>0 – 94</span></div>
</li>
<li class="other" data-start="0" data-end="57">
<div><strong>6C2R</strong><span>13</span><span>0 – 57</span></div>
</li>
<li class="clear r3" data-start="0" data-end="165">
<div><strong>Half 3C1R</strong><span>42</span><span>0 – 165</span></div>
</li>
<li class="r2" data-start="0" data-end="341">
<div><strong>Half 2C1R</strong><span>73</span><span>0 – 341</span></div>
</li>
<li class="r1" data-start="57" data-end="530">
<div><strong>Half 1C1R</strong><span>226</span><span>57 – 530</span></div>
</li>
<li class="r0" data-start="500" data-end="1446">
<div><strong>Half-Niece / Nephew</strong><span>891</span><span>500 – 1446</span></div>
</li>
<li class="r0" data-start="1349" data-end="2175">
<div><strong>Niece / Nephew</strong><span>1750</span><span>1349 – 2175</span></div>
</li>
<li class="rr" data-start="3330" data-end="3720">
<div><strong>Child</strong><span>3487</span><span>3330 – 3720</span></div>
</li>
<li class="r1" data-start="141" data-end="851">
<div><strong>1C1R</strong><span>439</span><span>141 – 851</span></div>
</li>
<li class="r2" data-start="0" data-end="316">
<div><strong>2C1R</strong><span>123</span><span>0 – 316</span></div>
</li>
<li class="r3" data-start="0" data-end="173">
<div><strong>3C1R</strong><span>48</span><span>0 – 173</span></div>
</li>
<li class="r4" data-start="0" data-end="117">
<div><strong>4C1R</strong><span>28</span><span>0 – 117</span></div>
</li>
<li class="r5" data-start="0" data-end="79">
<div><strong>5C1R</strong><span>21</span><span>0 – 79</span></div>
</li>
<li class="other" data-start="0" data-end="57">
<div><strong>7C</strong><span>13</span><span>0 – 57</span></div>
</li>
<li class="clear r3" data-start="0" data-end="96">
<div><strong>Half 3C2R</strong><span>34</span><span>0 – 96</span></div>
</li>
<li class="r2" data-start="0" data-end="353">
<div><strong>Half 2C2R</strong><span>61</span><span>0 – 353</span></div>
</li>
<li class="r1" data-start="37" data-end="360">
<div><strong>Half 1C2R</strong><span>145</span><span>37 – 360</span></div>
</li>
<li class="r0" data-start="125" data-end="765">
<div><strong>Half Great-Niece / Nephew</strong><span>432</span><span>125 – 765</span></div>
</li>
<li class="r0" data-start="251" data-end="2108">
<div><strong>Great Niece / Nephew</strong><span>910</span><span>251 – 2108</span></div>
</li>
<li class="rr" data-start="1156" data-end="2311">
<div><strong>Grandchild</strong><span>1766</span><span>1156 – 2311</span></div>
</li>
<li class="r1" data-start="43" data-end="531">
<div><strong>1C2R</strong><span>229</span><span>43 – 531</span></div>
</li>
<li class="r2" data-start="0" data-end="261">
<div><strong>2C2R</strong><span>74</span><span>0 – 261</span></div>
</li>
<li class="r3" data-start="0" data-end="116">
<div><strong>3C2R</strong><span>35</span><span>0 – 116</span></div>
</li>
<li class="r4" data-start="0" data-end="109">
<div><strong>4C2R</strong><span>22</span><span>0 – 109</span></div>
</li>
<li class="r5" data-start="0" data-end="43">
<div><strong>5C2R</strong><span>17</span><span>0 – 43</span></div>
</li>
<li class="other" data-start="0" data-end="53">
<div><strong>7C1R</strong><span>13</span><span>0 – 53</span></div>
</li>
<li class="clear r3">
<div><strong>Half 3C3R</strong></div>
</li>
<li class="r2">
<div><strong>Half 2C3R</strong></div>
</li>
<li class="r1" data-start="0" data-end="191">
<div><strong>Half 1C3R</strong><span>87</span><span>0 – 191</span></div>
</li>
<li class="r0" data-start="12" data-end="383">
<div><strong>Half GG Niece / Nephew</strong><span>187</span><span>12 – 383</span></div>
</li>
<li class="r0" data-start="191" data-end="885">
<div><strong>Great Great Niece / Nephew</strong><span>427</span><span>191 – 885</span></div>
</li>
<li class="rr" data-start="464" data-end="1486">
<div><strong>Great-Grandchild</strong><span>881</span><span>464 – 1486</span></div>
</li>
<li class="r1" data-start="0" data-end="283">
<div><strong>1C3R</strong><span>123</span><span>0 – 283</span></div>
</li>
<li class="r2" data-start="0" data-end="139">
<div><strong>2C3R</strong><span>57</span><span>0 – 139</span></div>
</li>
<li class="r3" data-start="0" data-end="69">
<div><strong>3C3R</strong><span>22</span><span>0 – 69</span></div>
</li>
<li class="r4" data-start="0" data-end="82">
<div><strong>4C3R</strong><span>29</span><span>0 – 82</span></div>
</li>
<li class="r5" data-start="0" data-end="44">
<div><strong>5C3R</strong><span>11</span><span>0 – 44</span></div>
</li>
<li class="other" data-start="0" data-end="50">
<div><strong>8C</strong><span>12</span><span>0 – 50</span></div>
</li>
</ul>
<br style="clear:both" />
</body>
</html>
body {
background: #fff;
font-size: 0.85vmax;
font-family: helvetica neue, sans-serif;
padding: 10px 10px 50px;
min-width: 747px;
}
ul.rels:after {
content: "";
display: block;
margin-bottom: 20px;
}
#compare {
width: 100px;
box-sizing: border-box;
font-size: 18px;
border: 1px dashed #ccc;
padding: 10px;
}
ul.rels {
clear: both;
padding: 20px 0 0 0;
max-width: 1200px;
margin: 0 auto;
}
p {
margin: 0;
padding: 0 0 0.25rem;
}
ul {
list-style: none;
}
a {
text-decoration: none;
color: darkgreen;
}
.meta-left {
float: left;
}
.meta-middle {
float: left;
padding-left: 40px;
}
#key {
float: left;
padding-left: 40px;
}
#key li {
width: 8.333vw;
}
h3 {
margin-bottom: 10px;
}
label {
clear: both;
display: block;
margin-bottom: 10px;
}
.reset {
padding: 10px;
border: 1px solid #ccc;
background: #ccc;
color: #000;
display: block;
clear: both;
margin-left: 20px;
float: right;
}
ul li {
float: left;
text-align: center;
width: 8.33333332%;
box-sizing: border-box;
display: table;
background: #ccc;
height: 86px;
}
ul li div {
display: table-cell;
vertical-align: middle;
border: 1px solid #efefef;
box-sizing: border-box;
}
ul li.r3,
ul li.c3 {
background: #aaa;
}
ul li.r1 {
background: #adda7b;
}
ul li.r0 {
background: #d1d8e2;
}
ul li.other {
background: #fff;
font-size: 0.75vmax;
}
ul li.r2 {
background: #f5c3a0;
}
ul li.rr {
background: #b4c7e7;
}
ul li.r4 {
background: #ffeeb8;
}
ul li.r5 {
background: #d0cdff;
}
ul li.dotted {
background: none;
}
ul li.dotted div {
display: block;
width: 50%;
height: 86px;
border: 0;
border-left: 1px solid #fff;
border-right: 1px dashed #aaa;
}
ul li strong,
ul li span {
display: block;
}
ul li.span5 {
width: 41.666666666666%;
}
ul li.span7 {
width: 58.333333333333%;
}
ul li.span3 {
width: 25%;
}
ul li.span2 {
width: 16.666666666666%;
}
ul li.pad7 {
margin-left: 58.333333333333%;
}
ul li.pad8 {
margin-left: 66.666666666666%;
}
ul li.pad9 {
margin-left: 74.999999999999%;
}
li.clear {
clear: left;
}
strong {
word-wrap: break-word;
}
.is-animated {
-webkit-animation: 0.6s zoom-in;
animation: 0.6s zoom-in;
}
@-webkit-keyframes zoom-in {
0% {
-webkit-transform: scale(0.1);
transform: scale(0.1);
}
100% {
-webkit-transform: none;
transform: none;
}
}
@keyframes zoom-in {
0% {
-webkit-transform: scale(0.1);
transform: scale(0.1);
}
100% {
-webkit-transform: none;
transform: none;
}
}
(function($) {
// todo:
// add a slider
// possibly highlight the three matches that are closest to the entered value.
"use strict";
var delay = (function() {
var timer = 0;
return function(callback, ms) {
clearTimeout(timer);
timer = setTimeout(callback, ms);
};
})();
var presetcm = '{{ params.toolVar }}';
$(".reset").on("click", function(e) {
e.preventDefault();
$("#compare").val("");
resetChart();
});
$("#compare").on("keyup", function(e) {
delay(function() {
var currentval = parseInt($("#compare").val());
filterChart(currentval);
if($.isNumeric(currentval)){
$("#currentamount").attr('href','{{site.uri.public}}/tools/sharedcm/'+currentval);
}
else {
$("#currentamount").attr('href','{{site.uri.public}}/tools/sharedcm/');
}
}, 500);
});
if($.isNumeric(presetcm)){
$("#compare").val(presetcm);
delay(function() {
filterChart(parseInt(presetcm));
},500);
}
})(jQuery);
function filterChart($enteredval) {
//var $enteredval = );
var $rels = $(".rels li");
if ($("#compare").val() == "" ) {
resetChart();
}
$(".rels").addClass("filtered");
$rels
.removeClass("is-animated")
.fadeTo("fast", 0.25)
.promise()
.done(function() {
$rels
.filter(function(i) {
return (
$(this).attr("data-start") !== undefined &&
$enteredval >= $(this).attr("data-start") &&
$enteredval <= $(this).attr("data-end")
);
})
.addClass("is-animated")
.fadeTo("fast", 1);
});
}
function resetChart() {
$(".rels").removeClass("filtered");
$(".rels li").removeClass("is-animated").fadeOut().promise().done(function() {
$(".rels li").addClass("is-animated").fadeTo("fast", 1);
$("#currentamount").attr('href','https://dnapainter.com/tools/sharedcm/');
});
}
Also see: Tab Triggers