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.
<div id='allBtn'>
<button id="btn-show-all" type="button" class="btn-flat-border">全部開く</button>
<button id="btn-hide-all" type="button" class="btn-flat-border">全部閉じる</button>
</div>
<table id="ghibuli-table" class='cell-border display' style="width:100%">
<thead>
<tr>
<th></th>
<th>作品名</th>
<th>公開日</th>
<th>監督</th>
<th>上映時間 (分)</th>
</tr>
</thead>
<tbody>
<tr>
<td class='details-control'></td>
<td>耳をすませば</td>
<td>1995.7.15</td>
<td>近藤喜文</td>
<td>111</td>
<td>Whisper of the Heart</td>
<td>柊あおい</td>
<td> 本名陽子 ⋅ 高橋一生 ⋅ 立花 隆 ⋅ 室井 滋 ⋅ 露口 茂 ⋅ 小林桂樹 </td>
</tr>
<tr>
<td class='details-control'></td>
<td>魔女の宅急便</td>
<td>1989.7.29</td>
<td>宮崎 駿</td>
<td>102</td>
<td>Kiki's Delivery Service</td>
<td>角野栄子</td>
<td> 高山みなみ ⋅ 佐久間レイ ⋅ 山口勝平 ⋅ 加藤治子 ⋅ 戸田恵子 </td>
</tr>
<tr>
<td class='details-control'></td>
<td>となりのトトロ</td>
<td>1988.4.16</td>
<td>宮崎 駿</td>
<td>86</td>
<td>My Neighbor Totoro</td>
<td>宮崎 駿</td>
<td> 日高のり子 ⋅ 坂本千夏 ⋅ 糸井重里 ⋅ 島本須美 ⋅ 北林谷栄 ⋅ 高木 均 </td>
</tr>
<tr>
<td class='details-control'></td>
<td>レッドタートル ある島の物語</td>
<td>2016.9.17</td>
<td>マイケル・デュドク・ドゥ・ヴィット</td>
<td>81</td>
<td>LA TORTUE ROUGE</td>
<td>マイケル・デュドク・ドゥ・ヴィット</td>
<td></td>
</tr>
<tr>
<td class='details-control'></td>
<td>崖の上のポニョ</td>
<td>2008.7.19</td>
<td>宮崎 駿</td>
<td>101</td>
<td>Ponyo on the Cliff by the Sea</td>
<td>宮崎 駿</td>
<td> 山口智子 ⋅ 長嶋一茂 ⋅ 天海祐希 ⋅ 所ジョージ ⋅ 奈良柚莉愛 ⋅ 土井洋輝 ⋅ 柊 瑠美 ⋅ 矢野顕子 ⋅ 吉行和子 ⋅ 奈良岡朋子 </td>
</tr>
</tbody>
</table>
td.details-control {
text-align:center;
width:5%;
min-width:5%;
max-width:5%;
}
td.details-control:before {
font-family: "Font Awesome 5 Free";
content: "\f0fe";
font-weight: 900;
padding: 0px;
color: #f67280; /*アイコンの色*/
}
tr.shown td.details-control:before {
font-family: "Font Awesome 5 Free";
content: "\f146";
font-weight: 900;
padding-left: 0px;
color: #36b5b0; /*アイコンの色*/
}
#allBtn {
margin: 20px 0px 20px 0px;
padding-bottom: 20px;
border-bottom: solid 1px gray ;
}
.btn-flat-border {
display: inline-block;
padding: 0.3em 1em;
text-decoration: none;
color: #ff7f7f;
border: solid 2px #ff7f7f;
border-radius: 3px;
transition: .4s;
}
.btn-flat-border:hover {
background: #ff7f7f;
color: white;
}
function format ( d ) {
return '<table style="width:100%;font-size:12px;">'+
'<tr>'+
'<td>英語タイトル</td>'+
'<td>'+d[5]+'</td>'+
'</tr>'+
'<tr>'+
'<td >原作</td>'+
'<td>'+d[6]+'</td>'+
'</tr>'+
'<tr>'+
'<td>声の出演</td>'+
'<td>'+d[7]+'</td>'+
'</tr>'+
'</table>';
}
$(document).ready(function() {
var ghibuliTable = $('#ghibuli-table').DataTable({
searching: false,
lengthChange: false,
info: false,
paging: false,
columnDefs: [
// 非表示
{ targets: [5, 6, 7], visible: false }
]
});
$('#ghibuli-table tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = ghibuliTable.row(tr);
// 行の開閉イベント
if ( row.child.isShown() ) {
row.child.hide();
tr.removeClass('shown');
} else {
row.child( format(row.data()) ).show();
tr.addClass('shown');
}
});
// "全部開く" ボタン
$('#btn-show-all').on('click', function() {
// Enumerate all rows
ghibuliTable.rows().every(function() {
if(!this.child.isShown()) {
this.child(format(this.data())).show();
$(this.node()).addClass('shown');
}
});
});
// "全部閉じる" ボタン
$('#btn-hide-all').on('click', function() {
ghibuliTable.rows().every(function() {
if(this.child.isShown()) {
this.child.hide();
$(this.node()).removeClass('shown');
}
});
});
});
Also see: Tab Triggers