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 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

              
                <template id="element">
	<div class="element">
		<div class="atomic-number"></div>
		<div class="name"></div>
		<div class="symbol"></div>
		<div class="atomic-weight"></div>
	</div>	
</template>

<h1>Periodic Chart of the Elements</h1>
<div class="container" id="periodic-table">
	<header class="period">
		<div class="header">1</div>
		<div class="header">2</div>
		<div class="header">3</div>
		<div class="header">4</div>
		<div class="header">5</div>
		<div class="header">6</div>
		<div class="header">7</div>
	</header>
	
	<header class="group">
		<div class="header header__ia">I A</div>
		<div class="header header__iia">II A</div>
		<div class="header header__iiia">III A</div>
		<div class="header header__iva">IV A</div>
		<div class="header header__va">V A</div>
		<div class="header header__via">VI A</div>
		<div class="header header__viia">VII A</div>
		<div class="header header__viiia">
			<div>VIII A</div>
		</div>
		<div class="header header__ib">I B</div>
		<div class="header header__iib">II B</div>
		<div class="header header__iiib">III B</div>
		<div class="header header__ivb">IV B</div>
		<div class="header header__vb">V B</div>
		<div class="header header__vib">VI B</div>
		<div class="header header__viib">VII B</div>
		<div class="header header__noble">Noble Gases</div>
	</header>
	
	<section class="information">
		<dl>
			<dt>The Symbol.</dt>
			<dd>Shown in the middle of each block directly below the name of the element. The colour used indicates the physical state of the element under ordinary conditions: black for solids, green for liquids, and blue for gases.</dd>
			<dt>The Atomic Weight.</dt>
			<dd>Directly below the symbol for each element the atomic weight is shown in black. The values are taken from the official Report on Atomic Weights Cf. J. Amer. Chem. Soc. 84,4193 (1976). For elements not listed in the Report the mass number of the longest lived isotope is shown in brackets.</dd>
			<dt>The Atomic Number.</dt>
			<dd>Shown in red in the upper left hand corner.</dd>
		</dl>
	</section>
	
	<div class="lanthanide">
		*Lanthanide Series <span class="arrow">&rarr;</span>
	</div>
	<div class="actinide">
		*Actinide Series <span class="arrow">&rarr;</span>
	</div>
</div>

<p>Table of elements data sourced from <a href="https://github.com/Bowserinator/Periodic-Table-JSON" target="_blank" rel="noreferrer" title="Periodic Table JSON GIT repository">Periodic Table JSON</a> by Bowserinator. <a href="https://www.alamy.com/stock-photo-old-periodic-table-of-elements-showing-the-symbol-atomic-weight-atomic-135758502.html" title="Original reference image" target="_blank" rel="noreferrer">Original.</a></p>
              
            
!

CSS

              
                $element-width: 4.5rem;
$element-ratio: 1.1;
$element-height: $element-width * $element-ratio;

$red: hsl(351, 90%, 47%);
$green: hsl(140, 91%, 38%);
$blue: hsl(195, 90%, 41%);
$black: hsl(228, 4%, 26%);

* {
	box-sizing: border-box;
	padding: 0;
	margin: 0;
}

html {
	color: $black;
	font-family: 'Inter', sans-serif;
	font-feature-settings: 'tnum' 1;
	letter-spacing: -0.01rem;
}

h1 {
	font-size: 4.5rem;
	font-weight: 900;
	line-height: 1;
	margin: 0.5rem 0 0;
}

p {
	font-size: 0.75rem;
	margin-bottom: 1rem;
}

body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
}

.container {
	display: grid;

	grid-template-columns: 1.5rem repeat(18, $element-width);
	grid-template-rows: auto repeat(7, $element-height) 1rem $element-height 1rem $element-height;
	
	margin-bottom: 1rem;
}

.period {
	grid-row-start: 2;
	grid-row-end: 9;

	display: grid;

	grid-template-columns: 1fr;
	grid-template-rows: repeat(7, 1fr);

	.header {
		color: $black;
		
		display: flex;
		flex-direction: row;
		align-items: center;

		font-size: 1.75rem;
		font-weight: 900;
	}
}

.group {
	grid-column-start: 2;
	grid-column-end: end;
	grid-row-start: 1;
	grid-row-end: 6;

	display: contents;

	.header {
		color: $black;
		
		font-size: 1.75rem;
		font-family: 'Old Standard TT', serif;
		font-weight: 600;
		
		letter-spacing: -0.05rem;
		word-spacing: -0.25rem;
		line-height: 1;
		
		text-align: center;
		text-transform: uppercase;

		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		align-items: center;
		
		&__noble {
			font-size: 1.25rem;
		}
		
		&__viiia {
			padding: 0 1rem 1rem;
			
			div {
				border-bottom: 1px solid $black;
				padding-bottom: 0.25rem;
				width: 100%;
			}
		}

		&__iia,
		&__iiib,
		&__ivb,
		&__vb,
		&__vib,
		&__viib {
			grid-row: 2;
		}

		&__iiia,
		&__iva,
		&__va,
		&__via,
		&__viia,
		&__viiia,
		&__ib,
		&__iib {
			grid-row: 4;
		}

		&__ia { grid-column: 2; }
		&__iia { grid-column: 3; }
		&__iiia { grid-column: 4; }
		&__iva { grid-column: 5; }
		&__va { grid-column: 6; }
		&__via { grid-column: 7; }
		&__viia { grid-column: 8; }
		&__viiia { grid-column-start: 9; grid-column-end: 12; }
		&__ib { grid-column: 12; }
		&__iib { grid-column: 13; }
		&__iiib { grid-column: 14; }
		&__ivb { grid-column: 15; }
		&__vb { grid-column: 16; }
		&__vib { grid-column: 17; }
		&__viib { grid-column: 18; }
		&__noble { grid-column: 19; }
	}
}

.information {	
	color: $black;
	
	grid-row-start: 2;
	grid-row-end: 4;
	grid-column-start: 5;
	grid-column-end: 12;
	
	dl {
		line-height: 1;
		letter-spacing: 0.01rem;
	}
	
	dt {
		font-weight: 700;
		text-transform: uppercase;
	}
	
	dd {
		font-size: 0.75rem;
		margin-bottom: 0.5rem;
		word-spacing: 0.05rem;
	}
}

.element {
	border: 1px solid $black;
	color: $black;
	line-height: 1;
	padding: 0.25rem;
	
	display: inline-block;
	margin-left: -1px;
	margin-bottom: -1px;
	
	.atomic-number {
		color: $red;
		font-feature-settings: 'tnum' 0;
		font-size: 0.9rem;
		font-weight: 700;
		letter-spacing: -0.05rem;
		line-height: 1.25;
	}
	
	.name {
		color: $green;
		font-size: 0.5rem;
		font-weight: 800;
		text-transform: uppercase;
	}
	
	.symbol {
		font-size: 1.5rem;
		font-weight: 900;
		line-height: 1.25;
		margin-top: 0.25rem;
		text-align: center;
	}
	
	.atomic-weight {
		font-feature-settings: 'tnum' 0;
		font-size: 0.5rem;
		font-weight: 500;
		text-align: center;
	}
	
	&__gas {
		.symbol {
			color: $blue;
		}
	}
	
	&__liquid {
		.symbol {
			color: $green;
		}
	}
}

.He { grid-column: 19; }
.B { grid-column: 14; }

.Ce,.Pr,.Nd,.Pm,.Sm,.Eu,.Gd,.Tb,.Dy,.Ho,.Er,.Tm,.Yb,.Lu {
	grid-row: 10;
}

.Th,.Pa,.U,.Np,.Pu,.Am,.Cm,.Bk,.Cf,.Es,.Fm,.Md,.No,.Lr {
	grid-row: 12;
}

.lanthanide,
.actinide {
	display: flex;
	justify-content: flex-end;
	align-items: center;
	
	font-size: 0.6rem;
	font-weight: 600;
	
	grid-column-start: 1;
	grid-column-end: 6;
	
	padding-right: 1rem;
}

.lanthanide {
	grid-row: 10;
}

.actinide {
	grid-row: 12;
}

.arrow {
	font-size: 200%;
}
              
            
!

JS

              
                const ELEMENTS = [
	{
		name: "Hydrogen",
		atomic_mass: 1.008,
		number: 1,
		phase: "Gas",
		symbol: "H"
	},
	{
		name: "Helium",
		atomic_mass: 4.0026022,
		number: 2,
		phase: "Gas",
		symbol: "He"
	},
	{
		name: "Lithium",
		atomic_mass: 6.94,
		number: 3,
		phase: "Solid",
		symbol: "Li"
	},
	{
		name: "Beryllium",
		atomic_mass: 9.01218315,
		number: 4,
		phase: "Solid",
		symbol: "Be"
	},
	{
		name: "Boron",
		atomic_mass: 10.81,
		number: 5,
		phase: "Solid",
		symbol: "B"
	},
	{
		name: "Carbon",
		atomic_mass: 12.011,
		number: 6,
		phase: "Solid",
		symbol: "C"
	},
	{
		name: "Nitrogen",
		atomic_mass: 14.007,
		number: 7,
		phase: "Gas",
		symbol: "N"
	},
	{
		name: "Oxygen",
		atomic_mass: 15.999,
		number: 8,
		phase: "Gas",
		symbol: "O"
	},
	{
		name: "Fluorine",
		atomic_mass: 18.9984031636,
		number: 9,
		phase: "Gas",
		symbol: "F"
	},
	{
		name: "Neon",
		atomic_mass: 20.17976,
		number: 10,
		phase: "Gas",
		symbol: "Ne"
	},
	{
		name: "Sodium",
		atomic_mass: 22.989769282,
		number: 11,
		phase: "Solid",
		symbol: "Na"
	},
	{
		name: "Magnesium",
		atomic_mass: 24.305,
		number: 12,
		phase: "Solid",
		symbol: "Mg"
	},
	{
		name: "Aluminium",
		atomic_mass: 26.98153857,
		discovered_by: null,
		number: 13,
		phase: "Solid",
		symbol: "Al"
	},
	{
		name: "Silicon",
		atomic_mass: 28.085,
		number: 14,
		phase: "Solid",
		symbol: "Si"
	},
	{
		name: "Phosphorus",
		atomic_mass: 30.9737619985,
		number: 15,
		phase: "Solid",
		symbol: "P"
	},
	{
		name: "Sulfur",
		atomic_mass: 32.06,
		number: 16,
		phase: "Solid",
		symbol: "S"
	},
	{
		name: "Chlorine",
		atomic_mass: 35.45,
		number: 17,
		phase: "Gas",
		symbol: "Cl"
	},
	{
		name: "Argon",
		atomic_mass: 39.9481,
		number: 18,
		phase: "Gas",
		symbol: "Ar"
	},
	{
		name: "Potassium",
		atomic_mass: 39.09831,
		number: 19,
		phase: "Solid",
		symbol: "K"
	},
	{
		name: "Calcium",
		atomic_mass: 40.0784,
		number: 20,
		phase: "Solid",
		symbol: "Ca"
	},
	{
		name: "Scandium",
		atomic_mass: 44.9559085,
		number: 21,
		phase: "Solid",
		symbol: "Sc"
	},
	{
		name: "Titanium",
		atomic_mass: 47.8671,
		number: 22,
		phase: "Solid",
		symbol: "Ti"
	},
	{
		name: "Vanadium",
		atomic_mass: 50.94151,
		number: 23,
		phase: "Solid",
		symbol: "V"
	},
	{
		name: "Chromium",
		atomic_mass: 51.99616,
		number: 24,
		phase: "Solid",
		symbol: "Cr"
	},
	{
		name: "Manganese",
		atomic_mass: 54.9380443,
		number: 25,
		phase: "Solid",
		symbol: "Mn"
	},
	{
		name: "Iron",
		atomic_mass: 55.8452,
		number: 26,
		phase: "Solid",
		symbol: "Fe"
	},
	{
		name: "Cobalt",
		atomic_mass: 58.9331944,
		number: 27,
		phase: "Solid",
		symbol: "Co"
	},
	{
		name: "Nickel",
		atomic_mass: 58.69344,
		number: 28,
		phase: "Solid",
		symbol: "Ni"
	},
	{
		name: "Copper",
		atomic_mass: 63.5463,
		number: 29,
		phase: "Solid",
		symbol: "Cu"
	},
	{
		name: "Zinc",
		atomic_mass: 65.382,
		number: 30,
		phase: "Solid",
		symbol: "Zn"
	},
	{
		name: "Gallium",
		atomic_mass: 69.7231,
		number: 31,
		phase: "Solid",
		symbol: "Ga"
	},
	{
		name: "Germanium",
		atomic_mass: 72.6308,
		number: 32,
		phase: "Solid",
		symbol: "Ge"
	},
	{
		name: "Arsenic",
		atomic_mass: 74.9215956,
		number: 33,
		phase: "Solid",
		symbol: "As"
	},
	{
		name: "Selenium",
		atomic_mass: 78.9718,
		number: 34,
		phase: "Solid",
		symbol: "Se"
	},
	{
		name: "Bromine",
		atomic_mass: 79.904,
		number: 35,
		phase: "Liquid",
		symbol: "Br"
	},
	{
		name: "Krypton",
		atomic_mass: 83.7982,
		number: 36,
		phase: "Gas",
		symbol: "Kr"
	},
	{
		name: "Rubidium",
		atomic_mass: 85.46783,
		number: 37,
		phase: "Solid",
		symbol: "Rb"
	},
	{
		name: "Strontium",
		atomic_mass: 87.621,
		number: 38,
		phase: "Solid",
		symbol: "Sr"
	},
	{
		name: "Yttrium",
		atomic_mass: 88.905842,
		number: 39,
		phase: "Solid",
		symbol: "Y"
	},
	{
		name: "Zirconium",
		atomic_mass: 91.2242,
		number: 40,
		phase: "Solid",
		symbol: "Zr"
	},
	{
		name: "Niobium",
		atomic_mass: 92.906372,
		number: 41,
		phase: "Solid",
		symbol: "Nb"
	},
	{
		name: "Molybdenum",
		atomic_mass: 95.951,
		number: 42,
		phase: "Solid",
		symbol: "Mo"
	},
	{
		name: "Technetium",
		atomic_mass: 98,
		number: 43,
		phase: "Solid",
		symbol: "Tc"
	},
	{
		name: "Ruthenium",
		atomic_mass: 101.072,
		number: 44,
		phase: "Solid",
		symbol: "Ru"
	},
	{
		name: "Rhodium",
		atomic_mass: 102.905502,
		number: 45,
		phase: "Solid",
		symbol: "Rh"
	},
	{
		name: "Palladium",
		atomic_mass: 106.421,
		number: 46,
		phase: "Solid",
		symbol: "Pd"
	},
	{
		name: "Silver",
		atomic_mass: 107.86822,
		number: 47,
		phase: "Solid",
		symbol: "Ag"
	},
	{
		name: "Cadmium",
		atomic_mass: 112.4144,
		number: 48,
		phase: "Solid",
		symbol: "Cd"
	},
	{
		name: "Indium",
		atomic_mass: 114.8181,
		number: 49,
		phase: "Solid",
		symbol: "In"
	},
	{
		name: "Tin",
		atomic_mass: 118.7107,
		number: 50,
		phase: "Solid",
		symbol: "Sn"
	},
	{
		name: "Antimony",
		atomic_mass: 121.7601,
		number: 51,
		phase: "Solid",
		symbol: "Sb"
	},
	{
		name: "Tellurium",
		atomic_mass: 127.603,
		number: 52,
		phase: "Solid",
		symbol: "Te"
	},
	{
		name: "Iodine",
		atomic_mass: 126.904473,
		number: 53,
		phase: "Solid",
		symbol: "I"
	},
	{
		name: "Xenon",
		atomic_mass: 131.2936,
		number: 54,
		phase: "Gas",
		symbol: "Xe"
	},
	{
		name: "Cesium",
		atomic_mass: 132.905451966,
		number: 55,
		phase: "Solid",
		symbol: "Cs"
	},
	{
		name: "Barium",
		atomic_mass: 137.3277,
		number: 56,
		phase: "Solid",
		symbol: "Ba"
	},
	{
		name: "Lanthanum",
		atomic_mass: 138.905477,
		number: 57,
		phase: "Solid",
		symbol: "La"
	},
	{
		name: "Cerium",
		atomic_mass: 140.1161,
		number: 58,
		phase: "Solid",
		symbol: "Ce"
	},
	{
		name: "Praseodymium",
		atomic_mass: 140.907662,
		number: 59,
		phase: "Solid",
		symbol: "Pr"
	},
	{
		name: "Neodymium",
		atomic_mass: 144.2423,
		number: 60,
		phase: "Solid",
		symbol: "Nd"
	},
	{
		name: "Promethium",
		atomic_mass: 145,
		number: 61,
		phase: "Solid",
		symbol: "Pm"
	},
	{
		name: "Samarium",
		atomic_mass: 150.362,
		number: 62,
		phase: "Solid",
		symbol: "Sm"
	},
	{
		name: "Europium",
		atomic_mass: 151.9641,
		number: 63,
		phase: "Solid",
		symbol: "Eu"
	},
	{
		name: "Gadolinium",
		atomic_mass: 157.253,
		number: 64,
		phase: "Solid",
		symbol: "Gd"
	},
	{
		name: "Terbium",
		atomic_mass: 158.925352,
		number: 65,
		phase: "Solid",
		symbol: "Tb"
	},
	{
		name: "Dysprosium",
		atomic_mass: 162.5001,
		number: 66,
		phase: "Solid",
		symbol: "Dy"
	},
	{
		name: "Holmium",
		atomic_mass: 164.930332,
		number: 67,
		phase: "Solid",
		symbol: "Ho"
	},
	{
		name: "Erbium",
		atomic_mass: 167.2593,
		number: 68,
		phase: "Solid",
		symbol: "Er"
	},
	{
		name: "Thulium",
		atomic_mass: 168.934222,
		number: 69,
		phase: "Solid",
		symbol: "Tm"
	},
	{
		name: "Ytterbium",
		atomic_mass: 173.0451,
		number: 70,
		phase: "Solid",
		symbol: "Yb"
	},
	{
		name: "Lutetium",
		atomic_mass: 174.96681,
		number: 71,
		phase: "Solid",
		symbol: "Lu"
	},
	{
		name: "Hafnium",
		atomic_mass: 178.492,
		number: 72,
		phase: "Solid",
		symbol: "Hf"
	},
	{
		name: "Tantalum",
		atomic_mass: 180.947882,
		number: 73,
		phase: "Solid",
		symbol: "Ta"
	},
	{
		name: "Tungsten",
		atomic_mass: 183.841,
		number: 74,
		phase: "Solid",
		symbol: "W"
	},
	{
		name: "Rhenium",
		atomic_mass: 186.2071,
		number: 75,
		phase: "Solid",
		symbol: "Re"
	},
	{
		name: "Osmium",
		atomic_mass: 190.233,
		number: 76,
		phase: "Solid",
		symbol: "Os"
	},
	{
		name: "Iridium",
		atomic_mass: 192.2173,
		number: 77,
		phase: "Solid",
		symbol: "Ir"
	},
	{
		name: "Platinum",
		atomic_mass: 195.0849,
		number: 78,
		phase: "Solid",
		symbol: "Pt"
	},
	{
		name: "Gold",
		atomic_mass: 196.9665695,
		number: 79,
		phase: "Solid",
		symbol: "Au"
	},
	{
		name: "Mercury",
		atomic_mass: 200.5923,
		number: 80,
		phase: "Liquid",
		symbol: "Hg"
	},
	{
		name: "Thallium",
		atomic_mass: 204.38,
		number: 81,
		phase: "Solid",
		symbol: "Tl"
	},
	{
		name: "Lead",
		atomic_mass: 207.21,
		number: 82,
		phase: "Solid",
		symbol: "Pb"
	},
	{
		name: "Bismuth",
		atomic_mass: 208.980401,
		number: 83,
		phase: "Solid",
		symbol: "Bi"
	},
	{
		name: "Polonium",
		atomic_mass: 209,
		number: 84,
		phase: "Solid",
		symbol: "Po"
	},
	{
		name: "Astatine",
		atomic_mass: 210,
		number: 85,
		phase: "Solid",
		symbol: "At"
	},
	{
		name: "Radon",
		atomic_mass: 222,
		number: 86,
		phase: "Gas",
		symbol: "Rn"
	},
	{
		name: "Francium",
		atomic_mass: 223,
		number: 87,
		phase: "Solid",
		symbol: "Fr"
	},
	{
		name: "Radium",
		atomic_mass: 226,
		number: 88,
		phase: "Solid",
		symbol: "Ra"
	},
	{
		name: "Actinium",
		atomic_mass: 227,
		number: 89,
		phase: "Solid",
		symbol: "Ac"
	},
	{
		name: "Thorium",
		atomic_mass: 232.03774,
		number: 90,
		phase: "Solid",
		symbol: "Th"
	},
	{
		name: "Protactinium",
		atomic_mass: 231.035882,
		number: 91,
		phase: "Solid",
		symbol: "Pa"
	},
	{
		name: "Uranium",
		atomic_mass: 238.028913,
		number: 92,
		phase: "Solid",
		symbol: "U"
	},
	{
		name: "Neptunium",
		atomic_mass: 237,
		number: 93,
		phase: "Solid",
		symbol: "Np"
	},
	{
		name: "Plutonium",
		atomic_mass: 244,
		number: 94,
		phase: "Solid",
		symbol: "Pu"
	},
	{
		name: "Americium",
		atomic_mass: 243,
		number: 95,
		phase: "Solid",
		symbol: "Am"
	},
	{
		name: "Curium",
		atomic_mass: 247,
		number: 96,
		phase: "Solid",
		symbol: "Cm"
	},
	{
		name: "Berkelium",
		atomic_mass: 247,
		number: 97,
		phase: "Solid",
		symbol: "Bk"
	},
	{
		name: "Californium",
		atomic_mass: 251,
		number: 98,
		phase: "Solid",
		symbol: "Cf"
	},
	{
		name: "Einsteinium",
		atomic_mass: 252,
		number: 99,
		phase: "Solid",
		symbol: "Es"
	},
	{
		name: "Fermium",
		atomic_mass: 257,
		number: 100,
		phase: "Solid",
		symbol: "Fm"
	},
	{
		name: "Mendelevium",
		atomic_mass: 258,
		number: 101,
		phase: "Solid",
		symbol: "Md"
	},
	{
		name: "Nobelium",
		atomic_mass: 259,
		number: 102,
		phase: "Solid",
		symbol: "No"
	},
	{
		name: "Lawrencium",
		atomic_mass: 266,
		number: 103,
		phase: "Solid",
		symbol: "Lr"
	},
	{
		name: "Rutherfordium",
		atomic_mass: 267,
		number: 104,
		phase: "Solid",
		symbol: "Rf"
	},
	{
		name: "Dubnium",
		atomic_mass: 268,
		number: 105,
		phase: "Solid",
		symbol: "Db"
	},
	{
		name: "Seaborgium",
		atomic_mass: 269,
		number: 106,
		phase: "Solid",
		symbol: "Sg"
	},
	{
		name: "Bohrium",
		atomic_mass: 270,
		number: 107,
		phase: "Solid",
		symbol: "Bh"
	}
];

const createElement = element => {
	let fragment = document.getElementById("element").content.cloneNode(true);

	fragment.querySelector(".element").classList.add(element.symbol);
	fragment.querySelector(".atomic-number").innerText = element.number;
	fragment.querySelector(".name").innerText = element.name;
	fragment.querySelector(".symbol").innerText = element.symbol;
	fragment.querySelector(".atomic-weight").innerText = element.atomic_mass;

	switch (element.phase) {
		case "Gas":
			fragment.querySelector(".element").classList.add("element__gas");
			break;
		case "Liquid":
			fragment.querySelector(".element").classList.add("element__liquid");
			break;
		default:
	}

	return fragment;
};

function init() {
	for (let i = 0; i < ELEMENTS.length; i++) {
		let element = createElement(ELEMENTS[i]);

		document.getElementById("periodic-table").appendChild(element);
	}
}

init();

              
            
!
999px

Console