Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ 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

Auto Save

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

              
                <table typeof="MusicGroup" vocab="http://schema.org/">
	<caption><span property="name">Bruce Springsteen</span>’s studio albums</caption>
	<thead>
		<tr>
			<th>title</th>
			<th>release date</th>
		</tr>
	</thead>
	<tbody>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Greetings from Asbury Park, N.J.</td>
			<td><time property="datePublished">1973-01-05</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">The Wild, the Innocent &amp; the E Street Shuffle</td>
			<td><time xproperty="datePublished">1973-09-11</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Born to Run</td>
			<td><time property="datePublished">1975-08-25</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Darkness on the Edge of Town</td>
			<td><time property="datePublished">1978-06-02</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">The River</td>
			<td><time property="datePublished">1980-10-10</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Nebraska</td>
			<td><time property="datePublished">1982-09-20</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Born in the U.S.A.</td>
			<td><time property="datePublished">1984-06-04</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Tunnel of Love</td>
			<td><time property="datePublished">1987-10-09</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Human Touch</td>
			<td><time property="datePublished">1992-03-31</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Lucky Town</td>
			<td><time property="datePublished">1992-03-31</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">The Ghost of Tom Joad</td>
			<td><time property="datePublished">1995-11-21</time></td>
		</tr>
		<tr>
			<td><button>show all</button></td>
		</tr>
	</tbody>
	<tbody hidden>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">The Rising</td>
			<td><time property="datePublished">2002-07-30</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Devils &amp; Dust</td>
			<td><time property="datePublished">2005-04-26</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">We Shall Overcome: The Seeger Sessions</td>
			<td><time property="datePublished">2006-04-25</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Magic</td>
			<td><time property="datePublished">2007-09-25</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Working on a Dream</td>
			<td><time property="datePublished">2009-01-27</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Wrecking Ball</td>
			<td><time property="datePublished">2012-03-06</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">High Hopes</td>
			<td><time property="datePublished">2014-01-14</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Western Stars</td>
			<td><time property="datePublished">2019-06-14</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Letter to You</td>
			<td><time property="datePublished">2020-10-23</time></td>
		</tr>
		<tr property="album" typeof="MusicAlbum">
			<td property="name">Only the Strong Survive</td>
			<td><time property="datePublished">2022-11-11</time></td>
		</tr>
	</tbody>
</table>

              
            
!

CSS

              
                html
{
	font: 1.2em/1.4 Calibri;
}

body
{
	max-width: 25em;
}

table
{
	border-collapse: collapse;
	line-height: 1;
	margin-bottom: 3em;
}

thead th
/* `thead {position: sticky}` doesn’t work in Edge or Chrome yet, but works for `thead th` which causes trouble in Safari */
{
	position: -webkit-sticky;
	position: sticky;
	top: 0;
	background: white;
}

@supports (position: -webkit-sticky)
{
	caption,
	{
		position: -webkit-sticky;
		top: 0;
		background: white;
	}
}

th, td
{
	vertical-align: top;
	text-align: start;
	padding: 0.3em 0;
}

thead th
{
	vertical-align: bottom;
	padding-bottom: 0;
}

thead th:after
{
	content: '';
	display: block;
	padding-bottom: 0.3em;
	border-bottom: thin solid silver;
}

th:not(:only-child):last-child,
td:not(:only-child):last-child
{
	text-align: end;
}

td:not(:first-child)
{
	padding-left: 2em;
}
              
            
!

JS

              
                const buttonElement = document.querySelector('button');
const tableElement = document.querySelector('table');

buttonElement.addEventListener('click', event => {	
	// buttonElement.closest('tr').hidden = true;
	for (let tBody of tableElement.tBodies) {
		tBody.hidden = false;
	}
});

              
            
!
999px

Console