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.
<!-- 「Navbar」のデモ(スマホ時はスライドバーが表示) -->
<h5>■「Navbar」のサンプル</h5>
<nav>
<div class="nav-wrapper">
<a href="#!" class="brand-logo">基本的なNavbar</a>
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<li><a href="#">ホーム</a></li>
<li><a href="#">リンク1</a></li>
<li><a href="#">リンク2</a></a>
</li>
<li><a href="#">リンク3</a></li>
</ul>
<ul class="side-nav" id="mobile-demo">
<li><a href="#">ホーム</a></li>
<li><a href="#">リンク1</a></li>
<li><a href="#">リンク2</a></li>
<li><a href="#">リンク3</a></li>
</ul>
</div>
</nav>
<div class="container">
<!-- 「カード」形式のデモ --------------------->
<h5>■「カード」のサンプル</h5>
<div class="row">
<div class="col s12 m6 l4">
<div class="card">
<div class="card-image">
<img src="http://materializecss.com/images/sample-1.jpg">
<span class="card-title">カードタイトル</span>
</div>
<div class="card-content">
<p>これは、イメージ画像を使った「カード」形式のサンプルです。</p>
</div>
<div class="card-action">
<a href="#">これはリンクです</a>
</div>
</div>
</div>
</div>
<br />
<hr />
<!-- モーダルのサンプル --------------->
<h5>■モーダルのサンプル</h5>
<a class="waves-effect waves-light btn" href="#modal1">クリックしてください</a>
<div id="modal1" class="modal">
<div class="modal-content">
<h4>ヘッダータイトル</h4>
<p>サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">確認</a>
</div>
</div>
<br />
<br />
<hr />
<!-- 「フォーム」のデモ -->
<h5>■「フォーム」のサンプル</h5>
<div class="row">
<form class="col s12">
<!-- 入力部品(input) -->
<div class="row">
<div class="input-field col s6">
<input id="first_name" type="text" class="validate">
<label for="first_name">姓</label>
</div>
<div class="input-field col s6">
<input id="last_name" type="text" class="validate">
<label for="last_name">名</label>
</div>
</div>
<!-- 選択部品(select) -->
<div class="row">
<div class="input-field col s12 m6">
<select class="icons">
<option value="" disabled selected>オプションを選択してください</option>
<option value="1" data-icon="http://materializecss.com/images/sample-1.jpg" class="circle">サンプル1</option>
<option value="2" data-icon="http://materializecss.com/images/office.jpg" class="circle">サンプル2</option>
<option value="3" data-icon="http://materializecss.com/images/yuna.jpg" class="circle">サンプル1</option>
</select>
<label>画像セレクト</label>
</div>
</div>
<!-- スイッチ部品 -->
<div class="row">
<div class="col s12">
<div class="switch">
<label>スイッチ</label>
<label>
Off
<input type="checkbox">
<span class="lever"></span>
On
</label>
</div>
</div>
</div>
<!-- 範囲指定部品(range) -->
<p class="range-field">
<input type="range" id="test5" min="0" max="100" />
</p>
<!-- 日付指定部品(date) -->
<label>日付(クリックしてください)</label>
<input type="date" class="datepicker">
<!-- submitボタン -->
<button class="btn waves-effect waves-light" type="submit" name="action">Submit
<i class="material-icons right">send</i>
</button>
</form>
</div>
<br />
<hr />
<!-- 「ローディング」のアニメーションデモ -->
<h5>■「ローディング」のサンプル</h5>
<p>「Linear」タイプ</p>
<div class="progress">
<div class="indeterminate"></div>
</div>
<p>「Circular」タイプ</p>
<div class="preloader-wrapper big active">
<div class="spinner-layer spinner-blue-only">
<div class="circle-clipper left">
<div class="circle"></div>
</div>
<div class="gap-patch">
<div class="circle"></div>
</div>
<div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
</div>
<br />
<hr />
<h5>■「カルーセル」のサンプル</h5>
<p>画像をドラッグ、またはフリックしてみてください!</p>
<div class="carousel">
<a class="carousel-item" href="#one!"><img src="http://lorempixel.com/250/250/nature/1"></a>
<a class="carousel-item" href="#two!"><img src="http://lorempixel.com/250/250/nature/2"></a>
<a class="carousel-item" href="#three!"><img src="http://lorempixel.com/250/250/nature/3"></a>
<a class="carousel-item" href="#four!"><img src="http://lorempixel.com/250/250/nature/4"></a>
<a class="carousel-item" href="#five!"><img src="http://lorempixel.com/250/250/nature/5"></a>
</div>
<hr />
<h5>■「アコーディオンメニュー」のサンプル</h5>
<br />
<ul class="collapsible" data-collapsible="accordion">
<li>
<div class="collapsible-header active"><i class="material-icons">filter_drama</i>1番目の項目</div>
<div class="collapsible-body">
<p>サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。</p>
</div>
</li>
<li>
<div class="collapsible-header"><i class="material-icons">place</i>2番目の項目</div>
<div class="collapsible-body">
<p>サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。</p>
</div>
</li>
<li>
<div class="collapsible-header"><i class="material-icons">whatshot</i>3番目の項目</div>
<div class="collapsible-body">
<p>サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。サンプルテキスト。</p>
</div>
</li>
</ul>
<br />
<hr />
<!-- 「ページネーション」のデモ -->
<h5>■「ページネーション」のサンプル</h5>
<ul class="pagination">
<li class="disabled"><a href="#!"><i class="material-icons">chevron_left</i></a></li>
<li class="active"><a href="#!">1</a></li>
<li class="waves-effect"><a href="#!">2</a></li>
<li class="waves-effect"><a href="#!">3</a></li>
<li class="waves-effect"><a href="#!">4</a></li>
<li class="waves-effect"><a href="#!">5</a></li>
<li class="waves-effect"><a href="#!"><i class="material-icons">chevron_right</i></a></li>
</ul>
<br />
<hr />
</div>
<!-- container -->
<!-- 「フッター」のデモ -->
<h5>■「フッター」のサンプル</h5>
<footer class="page-footer">
<div class="container">
<div class="row">
<div class="col l6 s12">
<h5 class="white-text">基本的なフッターコンテンツ</h5>
<p class="grey-text text-lighten-4">ここへグリッドレイアウトなどを併用併用してコンテンツを作成します。</p>
</div>
<div class="col l4 offset-l2 s12">
<h5 class="white-text">リンク</h5>
<ul>
<li><a class="grey-text text-lighten-3" href="#!">リンク1</a></li>
<li><a class="grey-text text-lighten-3" href="#!">リンク2</a></li>
<li><a class="grey-text text-lighten-3" href="#!">リンク3</a></li>
<li><a class="grey-text text-lighten-3" href="#!">リンク4</a></li>
</ul>
</div>
</div>
</div>
<div class="footer-copyright">
<div class="container">
© 2017 Copyright サンプル
<a class="grey-text text-lighten-4 right" href="#!">その他リンク</a>
</div>
</div>
</footer>
$(document).ready(function() {
//モーダルウィンドウの初期化
$('.modal').modal();
// Navbarモバイル用の画面スライドによるサイドバーの初期化
$(".button-collapse").sideNav();
// フォームのSelect部品のオプションの初期化
$('select').material_select();
// フォームのDate部品の初期化
$('.datepicker').pickadate({
selectMonths: true,
selectYears: 15
});
// カルーセルの初期化
$('.carousel').carousel();
});
Also see: Tab Triggers