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

              
                <div role="tooltip">吹き出しです</div>
<div class="field-row">
	<input checked type="checkbox" id="example2">
	<label for="example2">チェック済み</label>
</div>
<div class="field-row">
	<input disabled type="checkbox" id="example3">
	<label for="example3">チェック不可</label>
</div>
<div class="field-row">
	<input checked disabled type="checkbox" id="example4">
	<label for="example4">チェック変更不可</label>
</div>
<div class="field-row">
	<select>
		<option>5 - 5番目</option>
		<option>4 - 4番目</option>
		<option selected>3 - 3番目</option>
		<option>2 - 2番目</option>
		<option>1 - 1番目</option>
	</select>
</div>
<div class="field-row">
	<fieldset>
		<legend>グループ</legend>
		<div class="field-row">
			<input id="radio8" type="radio" name="fieldset-example2">
			<label for="radio8">1つ目</label>
		</div>
		<div class="field-row">
			<input id="radio9" type="radio" name="fieldset-example2">
			<label for="radio9">2つ目</label>
		</div>
		<div class="field-row">
			<input id="radio10" type="radio" name="fieldset-example2">
			<label for="radio10">3つ目</label>
		</div>
		<div class="field-row">
			<input id="radio11" type="radio" name="fieldset-example2">
			<label for="radio11">14目</label>
		</div>
	</fieldset>
</div>
<div role="progressbar" class="animate">
	<div style="width: 60%"></div>
</div>

<div class="window" style="max-width: 400px">
	<div class="title-bar">
		<div class="title-bar-text">サンプル</div>
		<div class="title-bar-controls">
			<button aria-label="Minimize"></button>
			<button aria-label="Maximize"></button>
			<button aria-label="Close"></button>
		</div>
	</div>
	<div class="window-body">
		<menu role="tablist">
			<button role="tab" aria-controls="music" aria-selected="true">タブ1</button>
			<button role="tab" aria-controls="dogs">タブ2</button>
			<button role="tab" aria-controls="food">タブ3</button>
		</menu>
		<article role="tabpanel" id="music">
			<p>タブ1の中身です</p>
			<fieldset>
				<legend>グループ</legend>
				<div class="field-row">
					<input id="radio25" type="radio" name="fieldset-example2">
					<label for="radio25">1つ目</label>
				</div>
				<div class="field-row">
					<input id="radio26" type="radio" name="fieldset-example2">
					<label for="radio26">2つ目</label>
				</div>
				<div class="field-row">
					<input id="radio27" type="radio" name="fieldset-example2">
					<label for="radio27">3つ目</label>
				</div>
				<div class="field-row">
					<input id="radio28" type="radio" name="fieldset-example2">
					<label for="radio28">4つ目</label>
				</div>
			</fieldset>
			<section class="field-row">
				<button>ボタン</button>
				<label>押しても何もないよ</label>
			</section>
		</article>

		<article role="tabpanel" hidden id="dogs">
			<img style="width: 100%" src="https://picsum.photos/200/300?grayscale" />
		</article>

		<article role="tabpanel" hidden id="food">
			<p>
				タブ3の中身です
			</p>
			<iframe width="100%" height="200" src="https://www.youtube.com/embed/TODJBQ0tnow" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
		</article>
		<section class="field-row" style="justify-content: flex-end">
			<button>適応</button>
			<button>キャンセル</button>
		</section>
	</div>
</div>
              
            
!

CSS

              
                body {
	width: 70%;
	margin: auto;
	margin-top: 3rem;
	background: #efefef;
}
div {
	margin-bottom: 1rem;
}

              
            
!

JS

              
                const tabButtons = document.querySelectorAll("[role=tab]");
tabButtons.forEach((tabButton) => {
	tabButton.addEventListener("click", (e) => {
		e.preventDefault();
		const tabContainer = e.target.parentElement.parentElement;
		const targetId = e.target.getAttribute("aria-controls");
		tabButtons.forEach((_tabButton) =>
			_tabButton.setAttribute("aria-selected", false)
		);
		tabButton.setAttribute("aria-selected", true);
		tabContainer
			.querySelectorAll("[role=tabpanel]")
			.forEach((tabPanel) => tabPanel.setAttribute("hidden", true));
		tabContainer
			.querySelector(`[role=tabpanel]#${targetId}`)
			.removeAttribute("hidden");
	});
});

              
            
!
999px

Console