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="body-in">
<div id="main">
<p>アーカイブをそれぞれの年ごとに表示するようにしました</p>
<p>最新の年のリスト一覧は表示するようにしてあります。それ以外はデフォルトで非表示。それぞれの年をクリックするとその年の投稿記事一覧が表示される仕組みです。</p>
<p>最大で横3列4段になります。<br>それぞれの月、カウント(そのpostにも)classが付けてあるので、色やら変更可能です。<br>逆にカウントが無いと上手く機能しないかも知れないので、デフォルトでカウント表示、ドロップダウンリスト<strong>ではなく</strong>通常表示にしておいて下さい</p>
<p>多分これで過去10年までなら、本来エライことになる縦スペースを多少確保できたと思います。<br>そういう場合は、ドロップダウンリストを使うべきなんでしょうけれども。</p>
</div>
</div>
<footer itemscope="" itemtype="http://schema.org/WPFooter">
<div id="footer" class="main-footer">
<div id="footer-in">
<div id="footer-widget">
<div class="footer-left">
<aside id="pages-2" class="widget widget_pages">
<h3 class="footer_widget_title">固定ページ</h3>
<ul>
<li class="page_item page-item-17"><a href="https://wp-simplicity.com/">Simplicityの特徴</a></li>
<li class="page_item page-item-7 page_item_has_children"><a href="https://wp-simplicity.com/downloads/">Simplicityのダウンロード</a>
<ul class="children">
<li class="page_item page-item-1339"><a href="https://wp-simplicity.com/downloads/child-theme/">Simplicityの子テーマ</a></li>
<li class="page_item page-item-35004"><a href="https://wp-simplicity.com/downloads/downloads2/">Simplicity2のダウンロード</a></li>
<li class="page_item page-item-35010"><a href="https://wp-simplicity.com/downloads/child-theme2/">Simplicity2の子テーマ</a></li>
<li class="page_item page-item-1877"><a href="https://wp-simplicity.com/downloads/skin/">Simplicityのスキン</a></li>
</ul>
</li>
<li class="page_item page-item-43"><a href="https://wp-simplicity.com/initialization/">Simplicityの初期設定・おすすめの設定</a></li>
<li class="page_item page-item-59"><a href="https://wp-simplicity.com/layout/">レイアウト見本</a></li>
<li class="page_item page-item-139 page_item_has_children"><a href="https://wp-simplicity.com/reference/">参考・技術情報</a>
<ul class="children">
<li class="page_item page-item-1143"><a href="https://wp-simplicity.com/reference/adoption-sites/">Simplicity導入サイト</a></li>
<li class="page_item page-item-21216"><a href="https://wp-simplicity.com/reference/crowdsourcing-service/">Simplicityカスタマイズ依頼向けのクラウドソーシングサービス</a></li>
</ul>
</li>
<li class="page_item page-item-9262 page_item_has_children"><a href="https://wp-simplicity.com/forums/">Simplicityサポートフォーラム</a>
<ul class="children">
<li class="page_item page-item-9258"><a href="https://wp-simplicity.com/forums/create-topic/">トピックの作成</a></li>
<li class="page_item page-item-13015"><a href="https://wp-simplicity.com/forums/unsupported/">サポート対象外のもの</a></li>
</ul>
</li>
<li class="page_item page-item-3185"><a href="https://wp-simplicity.com/sitemap/">サイトマップ</a></li>
</ul>
</aside>
</div>
<div class="footer-center">
<aside id="categories-3" class="widget widget_categories">
<h3 class="footer_widget_title">カテゴリー</h3>
<ul>
<li class="cat-item cat-item-3"><a href="https://wp-simplicity.com/category/news/" title="新着情報Simplicityに関する新着情報です。バージョンアップ、追加機能の報告など。">NEWS</a> (137)
</li>
<li class="cat-item cat-item-5"><a href="https://wp-simplicity.com/category/settings/" title="Simplicity、Wordpressの設定全般Simplicityの設定はもとより、Simplicityを使う上で便利な、Wordpressの設定に関する情報です。">設定いろいろ</a> (45)
<ul class="children">
<li class="cat-item cat-item-14"><a href="https://wp-simplicity.com/category/settings/local-test/" title="Simplicityのローカルテスト環境用の設定など。">ローカルテスト</a> (1)
</li>
<li class="cat-item cat-item-15"><a href="https://wp-simplicity.com/category/settings/server/" title="Simplicityとサーバーに関する情報です。">サーバー</a> (3)
</li>
<li class="cat-item cat-item-17"><a href="https://wp-simplicity.com/category/settings/1-to-2/">Simplicity1から2への移行</a> (3)
</li>
<li class="cat-item cat-item-13"><a href="https://wp-simplicity.com/category/settings/extension-class/" title="Simplicityの文章を彩る拡張クラスの紹介です。">拡張クラス</a> (2)
</li>
</ul>
</li>
<li class="cat-item cat-item-6"><a href="https://wp-simplicity.com/category/customizer/" title="Wordpress管理画面からできるカスタマイズWordpress管理画面から「外観→カスタマイズ」で行える設定に関する情報です。">カスタマイザー設定</a> (30)
</li>
<li class="cat-item cat-item-4"><a href="https://wp-simplicity.com/category/theme-custom/" title="テーマファイルのカスタマイズ方法などSimplicityのテーマファイルを編集してカスタマイズする方法の紹介です。テーマファイルのカスタマイズによる不具合、それに関する質問は、サポートできませんのでご了承ください。">テーマ改造</a> (34)
<ul class="children">
<li class="cat-item cat-item-16"><a href="https://wp-simplicity.com/category/theme-custom/tips/" title="ちょっとしたテーマカスタマイズのTipsです。">Tips</a> (8)
</li>
</ul>
</li>
</ul>
</aside>
</div>
<div class="footer-right">
<aside id="archives-4" class="widget widget_archive">
<h3 class="footer_widget_title">アーカイブ</h3>
<ul>
<li><a href="https://wp-simplicity.com/2016/01/">2016年1月</a> (3)</li>
<li><a href="https://wp-simplicity.com/2015/12/">2015年12月</a> (6)</li>
<li><a href="https://wp-simplicity.com/2015/11/">2015年11月</a> (6)</li>
<li><a href="https://wp-simplicity.com/2015/10/">2015年10月</a> (2)</li>
<li><a href="https://wp-simplicity.com/2015/09/">2015年9月</a> (7)</li>
<li><a href="https://wp-simplicity.com/2015/08/">2015年8月</a> (4)</li>
<li><a href="https://wp-simplicity.com/2015/07/">2015年7月</a> (12)</li>
<li><a href="https://wp-simplicity.com/2015/06/">2015年6月</a> (11)</li>
<li><a href="https://wp-simplicity.com/2015/05/">2015年5月</a> (9)</li>
<li><a href="https://wp-simplicity.com/2015/04/">2015年4月</a> (8)</li>
<li><a href="https://wp-simplicity.com/2015/03/">2015年3月</a> (10)</li>
<li><a href="https://wp-simplicity.com/2015/02/">2015年2月</a> (10)</li>
<li><a href="https://wp-simplicity.com/2015/01/">2015年1月</a> (13)</li>
<li><a href="https://wp-simplicity.com/2014/12/">2014年12月</a> (14)</li>
<li><a href="https://wp-simplicity.com/2014/11/">2014年11月</a> (17)</li>
<li><a href="https://wp-simplicity.com/2014/10/">2014年10月</a> (18)</li>
<li><a href="https://wp-simplicity.com/2014/09/">2014年9月</a> (19)</li>
<li><a href="https://wp-simplicity.com/2014/08/">2014年8月</a> (31)</li>
<li><a href="https://wp-simplicity.com/2014/07/">2014年7月</a> (33)</li>
</ul>
</aside>
</div>
</div>
<div class="clear"></div>
<div id="copyright" class="wrapper">
© 2014 <a href="https://wp-simplicity.com">Simplicity</a>
</div>
</div>
<!-- /#footer-in -->
</div>
<!-- /#footer -->
</footer>
#footer {
.widget_archive {
display: none;
}
.archive2 {
header {
position: relative;
&::before{
content:"clickで表示・非表示トグル";
position: absolute;
top: 50%;
right: -500px;
transform: translateY(-50%);
font-size: 10px;
color: #fff;
transition: .3s ease;
background-color: #833;
padding: 0 2px;
}
&:hover::before {
right: 0;
}
}
ul {
display: flex;
flex-flow: row wrap;
transition: .3s ease;
height: 100%;
opacity: 1;
visibility: visible;
padding: 0;
li {
flex: 1 27%;
margin: 2px 5px;
padding: 3px;
background-color: #fff;
color: #333;
border-radius: 3px;
transition: .3s ease;
font-size: 12px;
&:hover {
background-color: #333;
color: #fff;
box-shadow: 0 0 2px rgba(255,255,255,.8);
}
a{
display: flex;
flex-flow: row wrap;
justify-content: space-between;
text-decoration: none;
color: inherit;
font-size: inherit;
div:first-child {
margin-right: auto;
}
div:last-child {
span {
font-size: 10px;
}
}
}
}
}
.hide {
margin: 0;
height: 0;
opacity: 0;
visibility: hidden;
overflow: hidden;
}
}
}
/*以下不要*/
footer {
width: 100%;
#footer-in {
width: 100%;
#footer-widget {
display: flex;
flex-flow: row wrap;
margin: 0;
padding: 0;
justify-content: space-around;
width: 100%;
[class^=footer-] {
flex: 1 30%;
float: none;
width: initial;
margin: 5px;
&:last-child {
min-width: 33%;
}
}
}
}
}
(function($) {
$(function() {
var
wgt = $("footer .widget_archive"),
clone = wgt.clone(),
year = [];
//クローンして、手前に挿入。オリジナルはcssで非表示
wgt.before(clone);
$("footer .widget_archive:first").attr("class", "archive2");
var
acv = $("footer").find(".archive2"),
acvLi = acv.find("li");
//liのテキストから年がどこからあるかを調べる
acvLi.each(function(i) {
var dt = $(this).text().match(/(\d+)年(\d+)月\s\((\d+)\)/);
year.push(dt[1]);
});
$.unique(year); //重複削除
acvLi.unwrap(); //liの親のulを解除
//投稿年があるだけクローンした中にブロックを作る
var
yearCount = year.length,
i = 0;
while (i < yearCount) {
acv.append(
"<div class='year_" + year[i] + "'>" +
"<header>" + year[i] + "年</header>" +
"<ul></ul>" +
"</div>");
i++;
}
//作ったブロック内のulに内容を整形して移動
//オリジナルのクローンは順番に削除
var j = 0;
acvLi.each(function() {
var dt = $(this).text().match(/(\d+)年(\d+)月\s\((\d+)\)/),
href = $(this).find("a").attr("href"),
rTxt = "<li>" +
"<a href='" + href + "'>" +
"<div class='month'>" + dt[2] + "月</div>" +
"<div class='count'>" + dt[3] + "<span>post</span></div>" +
"</a>" +
"</li>";
if (year[j] === dt[1]) {
$(".year_" + year[j] + " ul").append(rTxt);
$(this).remove();
} else {
j++;
$(".year_" + year[j] + " ul").append(rTxt);
$(this).remove();
}
});
//headerの最初以外は.hide
acv.find("ul:not(:first)").addClass("hide");
//headerクリックでトグルshow
acv.find("header").on("click", function() {
$(this).next().toggleClass("hide");
});
});
})(jQuery);
Also see: Tab Triggers