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.
<form>
<div class="search-box">
<span class="search-box_label">Category:</span>
<input type="radio" name="category" value="">ALL
<input type="radio" name="category" value="HTML・CSS">HTML・CSS
<input type="radio" name="category" value="JavaScript">JavaScript
<input type="radio" name="category" value="CMS">CMS
<input type="radio" name="category" value="Program">Program
<input type="radio" name="category" value="Mobile">Mobile
<input type="radio" name="category" value="SEO・SEM">SEO・SEM
<input type="radio" name="category" value="ツール">ツール
<input type="radio" name="category" value="その他">その他
<input type="radio" name="category" value="殿堂入り">殿堂入り
</div>
<div class="search-box">
<span class="search-box_label">Tag:</span>
<input type="checkbox" name="tag" value="adobe">adobe
<input type="checkbox" name="tag" value="Android">Android
<input type="checkbox" name="tag" value="Chrome">Chrome
<input type="checkbox" name="tag" value="CSSの設計">CSSの設計
<input type="checkbox" name="tag" value="font">font
<input type="checkbox" name="tag" value="Google Chrome">Google Chrome
<input type="checkbox" name="tag" value="gulp">gulp
<input type="checkbox" name="tag" value="heroku">heroku
<input type="checkbox" name="tag" value="icon">icon
<input type="checkbox" name="tag" value="iPhone">iPhone
<input type="checkbox" name="tag" value="meta">meta
<input type="checkbox" name="tag" value="Movable Type">Movable Type
<input type="checkbox" name="tag" value="mysql">mysql
<input type="checkbox" name="tag" value="photoshop">photoshop
<input type="checkbox" name="tag" value="Sass">Sass
<input type="checkbox" name="tag" value="ssh">ssh
<input type="checkbox" name="tag" value="SVG">SVG
<input type="checkbox" name="tag" value="Webフォント">Webフォント
<input type="checkbox" name="tag" value="アドオン">アドオン
<input type="checkbox" name="tag" value="アニメーション">アニメーション
<input type="checkbox" name="tag" value="エクステンション">エクステンション
<input type="checkbox" name="tag" value="参考サイト">参考サイト
<input type="checkbox" name="tag" value="シェア">シェア
<input type="checkbox" name="tag" value="シェア調査">シェア調査
<input type="checkbox" name="tag" value="書体">書体
<input type="checkbox" name="tag" value="縦書き">縦書き
<input type="checkbox" name="tag" value="縦組み">縦組み
<input type="checkbox" name="tag" value="デザイン">デザイン
<input type="checkbox" name="tag" value="デバッグ">デバッグ
<input type="checkbox" name="tag" value="ブラウザ">ブラウザ
<input type="checkbox" name="tag" value="プラグイン">プラグイン
</div>
</form>
<ul class="list">
<li class="list_item" data-category='Program' data-tag='["ssh", "mysql"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/program/post14579.html">SSH のポートフォワーディングを使って MySQL に接続する</a><br>
Category: Program Tag: ssh,mysql
</li>
<li class="list_item" data-category='["ツール", "その他"]' data-tag='["photoshop", "エクステンション"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/tool/post14513.html">Photoshopのエクステンションを自作する</a><br>
Category: ツール,その他 Tag: photoshop,エクステンション
</li>
<li class="list_item" data-category='ツール' data-tag='["アドオン", "Google Chrome"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/tool/post14457.html">スピードアップ!仕事効率化おすすめChromeアドオン5選</a><br>
Category: ツール Tag: アドオン,Google Chrome
</li>
<li class="list_item" data-category='["HTML・CSS", "その他"]' data-tag='["iPhone", "Android", "ブラウザ", "シェア"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/html_css/post14411.html">対象ブラウザを見直してみる(2018年1月版)</a><br>
Category: HTML・CSS,その他 Tag: iPhone,Android,ブラウザ,シェア
</li>
<li class="list_item" data-category='HTML・CSS' data-tag='["SVG", "アニメーション"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/html_css/post14400.html">SVGでリアルな湯気を作ってみる</a><br>
Category: HTML・CSS Tag: SVG,アニメーション
</li>
<li class="list_item" data-category='その他' data-tag='["シェア調査", "ブラウザ"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/others/post13405.html">スマートフォン・PCのブラウザシェア調査(2017年12月分)</a><br>
Category: その他 Tag: シェア調査,ブラウザ
</li>
<li class="list_item" data-category='["HTML・CSS", "その他"]' data-tag='["font", "参考サイト", "縦書き", "デザイン"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/html_css/post13923.html">和風の縦書きサイトを作る時に気をつけたこと</a><br>
Category: HTML・CSS,その他 Tag: font,参考サイト,縦書き,デザイン
</li>
<li class="list_item" data-category='["HTML・CSS", "その他"]' data-tag='["Webフォント", "font", "書体", "縦書き", "縦組み"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/html_css/post13996.html">文字についてとCSSでの文字の制御(縦書きもあるよ)について</a><br>
Category: HTML・CSS,その他 Tag: Webフォント,font,書体,縦書き,縦組み
</li>
<li class="list_item" data-category='ツール' data-tag='["photoshop", "adobe"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/tool/post13915.html">これが便利!Photoshop CC 2018の新機能</a><br>
Category: ツール Tag: photoshop,adobe
</li>
<li class="list_item" data-category='Program' data-tag='heroku'>
<a href="https://www.tam-tam.co.jp/tipsnote/program/post14102.html">Heroku のエラーページをカスタマイズする</a><br>
Category: Program Tag: heroku
</li>
<li class="list_item" data-category='JavaScript' data-tag='["SVG", "gulp", "icon", "font"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/javascript/post11005.html">gulpでsvgからアイコンフォントを作成する</a><br>
Category: JavaScript Tag: SVG,gulp,icon,font
</li>
<li class="list_item" data-category='CMS' data-tag='["Movable Type", "プラグイン"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/cms/post13620.html">Movable Typeの構築や運用時によく使うプラグイン8選</a><br>
Category: CMS Tag: Movable Type,プラグイン
</li>
<li class="list_item" data-category='["HTML・CSS", "Mobile"]' data-tag='["Chrome", "デバッグ"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/html_css/post12799.html">Android の Chrome で開いたページを、PC から DevTools でデバッグする</a><br>
Category: HTML・CSS,Mobile Tag: Chrome,デバッグ
</li>
<li class="list_item" data-category='["HTML・CSS", "SEO・SEM"]' data-tag='meta'>
<a href="">開発環境でも使えるメタ情報チェックツール「Simple Meta Checker」を作りました</a><br>
Category: HTML・CSS,SEO・SEM Tag: meta
</li>
<li class="list_item" data-category='["HTML・CSS", "殿堂入り"]' data-tag='["Sass", "CSSの設計"]'>
<a href="https://www.tam-tam.co.jp/tipsnote/html_css/post10205.html">CSSの設計 – FLOCSSをベースにしたファイルの構成と命名規則を考える</a><br>
Category: HTML・CSS,殿堂入り Tag: Sass,CSSの設計
</li>
</ul>
.search-box_label {
font-weight: bold;
}
.is-hide {
display: none;
}
var searchBox = '.search-box'; // 絞り込む項目を選択するエリア
var listItem = '.list_item'; // 絞り込み対象のアイテム
var hideClass = 'is-hide'; // 絞り込み対象外の場合に付与されるclass名
$(function() {
// 絞り込み項目を変更した時
$(document).on('change', searchBox + ' input', function() {
search_filter();
});
});
/**
* リストの絞り込みを行う
*/
function search_filter() {
// 非表示状態を解除
$(listItem).removeClass(hideClass);
for (var i = 0; i < $(searchBox).length; i++) {
var name = $(searchBox).eq(i).find('input').attr('name');
// 選択されている項目を取得
var searchData = get_selected_input_items(name);
// 選択されている項目がない、またはALLを選択している場合は飛ばす
if(searchData.length === 0 || searchData[0] === '') {
continue;
}
// リスト内の各アイテムをチェック
for (var j = 0; j < $(listItem).length; j++) {
// アイテムに設定している項目を取得
var itemData = get_setting_values_in_item($(listItem).eq(j), name);
// 絞り込み対象かどうかを調べる
var check = array_match_check(itemData, searchData);
if(!check) {
$(listItem).eq(j).addClass(hideClass);
}
}
}
}
/**
* inputで選択されている値の一覧を取得する
* @param {String} name 対象にするinputのname属性の値
* @return {Array} 選択されているinputのvalue属性の値
*/
function get_selected_input_items(name) {
var searchData = [];
$('[name=' + name + ']:checked').each(function() {
searchData.push($(this).val());
});
return searchData;
}
/**
* リスト内のアイテムに設定している値の一覧を取得する
* @param {Object} target 対象にするアイテムのjQueryオブジェクト
* @param {String} data 対象にするアイテムのdata属性の名前
* @return {Array} 対象にするアイテムのdata属性の値
*/
function get_setting_values_in_item(target, data) {
var itemData = target.data(data);
if(!Array.isArray(itemData)) {
itemData = [itemData];
}
return itemData;
}
/**
* 2つの配列内で一致する文字列があるかどうかを調べる
* @param {Array} arr1 調べる配列1
* @param {Array} arr2 調べる配列2
* @return {Boolean} 一致する値があるかどうか
*/
function array_match_check(arr1, arr2) {
// 絞り込み対象かどうかを調べる
var arrCheck = false;
for (var i = 0; i < arr1.length; i++) {
if(arr2.indexOf(arr1[i]) >= 0) {
arrCheck = true;
break;
}
}
return arrCheck;
}
Also see: Tab Triggers