スマホにも対応。CSSだけで実装するパララックス
「clip-path: inset(0);」を指定し要素全体をクリップして、パララックスを実装しています。
<html style="max-height: 100%;"><head><script id="js-section">
</script><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><style id="basic-style">body,#svg-section{font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body,svg{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}</style><style id="root-style">:root{--pic-image-data:none;}</style><style id="out-style">.section {
position: relative;
width: 100vw;
height: 100vh;
}
.section-layer {
position: absolute;
inset: 0;
clip-path: inset(0);
/* 要素全体をクリップ */
}
.content {
display: grid;
place-content: center;
height: 100vh;
background-color: #efefef;
color: #353535;
font-size: 26px;
text-align: center;
}
.parallax {
position: fixed;
inset: 0;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-01 {
background-image: url(/storage/img/posts/64c9cd8b5a73d.jpg);
}
.bg-02 {
background-image: url(/storage/img/posts/64c9cd8b7c870.jpg);
}
</style><style id="pic-style"></style><style id="body-style">body,#svg-section {font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}</style><link href="chrome-extension://nffaoalbilbmmfgbnbgppjihopabppdk/inject.css" type="text/css" rel="stylesheet"></head><body id="svg-section" style="width: 600px; height: 337.5px; overflow: auto;" class="vsc-initialized"><div class="container">
<div class="section">
<div class="section-layer">
<div class="parallax bg-01"></div>
</div>
</div>
<div class="section">
<div class="section-layer">
<div class="content">
<p>content</p>
</div>
</div>
</div>
<div class="section">
<div class="section-layer">
<div class="parallax bg-02"></div>
</div>
</div>
</div>
</body></html>
CSSだけで実装するパララックス
「background-attachment: fixed;」を指定しパララックスを実装しています。 ※「background-attachment: fixed」はiOSのSafariではサポートしていません。 スマホで使用する場合はJSプラグインなどを使用する必要があります。
<html style="max-height: 100%;"><head><script id="js-section">
</script><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><style id="basic-style">body,#svg-section{font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body,svg{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}</style><style id="root-style">:root{--pic-image-data:none;}</style><style id="out-style">.content {
display: grid;
place-content: center;
height: 100vh;
background-color: #efefef;
color: #353535;
font-size: 26px;
text-align: center;
}
.parallax {
width: 100%;
height: 100vh;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-01 {
background-image: url(/storage/img/posts/64c9cd8b5a73d.jpg);
}
.bg-02 {
background-image: url(/storage/img/posts/64c9cd8b7c870.jpg);
}
</style><style id="pic-style"></style><style id="body-style">body,#svg-section {font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}</style><link href="chrome-extension://nffaoalbilbmmfgbnbgppjihopabppdk/inject.css" type="text/css" rel="stylesheet"></head><body id="svg-section" style="width: 600px; height: 337.5px; overflow: auto;" class="vsc-initialized"><div class="container">
<div class="parallax bg-01"></div>
<div class="content">
<p>content</p>
</div>
<div class="parallax bg-02"></div>
</div>
</body></html>
スクロール時に特定の位置でピタッと止めるスクロールスナップ
「scroll-snap-type: y mandatory;」で垂直方向(y)にスクロールを強制的(mandatory)に止めるようにしています。 「scroll-snap-align: start;」でスクロールが各 .item 要素の開始位置で止まるようにしています。
<html style="max-height: 100%;"><head><script id="js-section">
</script><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><style id="basic-style">body,#svg-section{font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body,svg{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}</style><style id="root-style">:root{--pic-image-data:none;}</style><style id="out-style">.pic-container {
background-color: white;
}
.carousel {
overflow: auto;
scroll-snap-type: y mandatory;
height: 100vh;
}
.item {
display: grid;
place-items: center;
font-size: 30px;
height: 100%;
scroll-snap-align: start;
background-color: #efefef;
}
.item:nth-child(odd) {
background-color: #fff;
}
</style><style id="pic-style"></style><style id="body-style">body,#svg-section {font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}</style><link href="chrome-extension://nffaoalbilbmmfgbnbgppjihopabppdk/inject.css" type="text/css" rel="stylesheet"></head><body id="svg-section" style="width: 600px; height: 337.5px; transform-origin: left top; transform: scale(1); overflow: auto;" class="vsc-initialized"><div class="pic-container">
<div class="carousel">
<div class="item">Item 1</div>
<div class="item">Item 2</div>
<div class="item">Item 3</div>
<div class="item">Item 4</div>
<div class="item">Item 5</div>
</div>
</div>
</body></html>
スクロールバーをグラデーションにしたCSSデザイン
「-webkit-scrollbar〜」でスクロールバーの色を変えてます。Firefox、Edge等のブラウザでは使えません。
<html style="max-height: 100%;"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><style id="basic-style">body,#svg-section{font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body,svg{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}</style><style id="root-style">:root{--pic-image-data:none;}</style><style id="out-style">.pic-container {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
box-sizing: border-box;
background-color: white;
padding: 8rem;
}
.box {
width: 200px;
height: 200px;
background-color: #f9f9f9;
color: #f9f9f9;
overflow-y: scroll;
font-size: 23px;
}
.box::-webkit-scrollbar {
width: 15px;
}
.box::-webkit-scrollbar-track {
background-color: #000;
border: 3px solid #aaa;
}
.box::-webkit-scrollbar-thumb {
background-image: linear-gradient(135deg, #F6D242 10%, #FF52E5 100%);
}
</style><style id="pic-style"></style><style id="body-style">body,#svg-section {font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}</style><link href="chrome-extension://nffaoalbilbmmfgbnbgppjihopabppdk/inject.css" type="text/css" rel="stylesheet"></head><body id="svg-section" style="width: 600px; height: 337.5px; transform-origin: left top; transform: scale(1);" class="vsc-initialized"><div class="pic-container">
<div class="box">
<p>スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。</p>
</div>
</div>
</body></html>
スクロールバーをグラデーションにしたCSSデザイン
「-webkit-scrollbar〜」でスクロールバーの色を変えてます。Firefox、Edge等のブラウザでは使えません。
<html style="max-height: 100%;"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><style id="basic-style">body,#svg-section{font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body,svg{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}</style><style id="root-style">:root{--pic-image-data:none;}</style><style id="out-style">.pic-container {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
box-sizing: border-box;
background-color: #fefefe;
padding: 8rem;
}
.box {
width: 200px;
height: 200px;
background-color: #2C2F35;
color: #2D3240;
overflow-y: scroll;
font-size: 23px;
}
.box::-webkit-scrollbar {
width: 14px;
}
.box::-webkit-scrollbar-track {
background-color: #000;
border-radius: 10px;
}
.box::-webkit-scrollbar-thumb {
background-image: linear-gradient(135deg, #3C8CE7 10%, #00EAFF 100%);
border-radius: 10px;
}
</style><style id="pic-style"></style><style id="body-style">body,#svg-section {font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}</style><link href="chrome-extension://nffaoalbilbmmfgbnbgppjihopabppdk/inject.css" type="text/css" rel="stylesheet"></head><body id="svg-section" style="width: 600px; height: 337.5px; transform-origin: left top; transform: scale(1);" class="vsc-initialized"><div class="pic-container">
<div class="box">
<p>スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。</p>
</div>
</div>
</body></html>
スクロールバーをライトグリーンにしたCSSデザイン
「-webkit-scrollbar〜」でスクロールバーの色を変えてます。Firefox、Edge等のブラウザでは使えません。
<html style="max-height: 100%;"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><style id="basic-style">body,#svg-section{font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body,svg{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}</style><style id="root-style">:root{--pic-image-data:none;}</style><style id="out-style">.pic-container {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
box-sizing: border-box;
background-color: #fefefe;
padding: 8rem;
}
.box {
width: 200px;
height: 200px;
background-color: #2D3240;
color: #2D3240;
overflow-y: scroll;
font-size: 23px;
}
.box::-webkit-scrollbar {
width: 14px;
}
.box::-webkit-scrollbar-track {
background-color: #EFEFEF;
border-radius: 10px;
}
.box::-webkit-scrollbar-thumb {
background-color: #A1CF4A;
border-radius: 10px;
}
</style><style id="pic-style"></style><style id="body-style">body,#svg-section {font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}</style><link href="chrome-extension://nffaoalbilbmmfgbnbgppjihopabppdk/inject.css" type="text/css" rel="stylesheet"></head><body id="svg-section" style="width: 600px; height: 337.5px; transform-origin: left top; transform: scale(1);" class="vsc-initialized"><div class="pic-container">
<div class="box">
<p>スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。スクロールバーをデザインする。</p>
</div>
</div>
</body></html>
スクロール時に見出しを固定する方法
h2タグの「position: sticky;」「top: 0;」でスクロール時に見出しを固定表示させています
<html style="max-height: 100%;"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><style id="basic-style">body,#svg-section{font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body,svg{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}</style><style id="root-style">:root{--pic-image-data:none;}</style><style id="out-style">.pic-container {
width: 100vw;
height: 100vh;
box-sizing: border-box;
background-color: white;
padding: 2rem;
overflow-y: auto;
}
h2 {
margin: 1rem 0 0.5rem;
padding: 1rem 0.5rem;
background-color: #3fa0da;
color: #fff;
/**************************/
/*section内で見出しを固定 */
/**************************/
position: sticky;
top: 0;
}
p {
line-height: 1.5;
}
</style><style id="pic-style"></style><style id="body-style">body,#svg-section {font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}</style><link href="chrome-extension://nffaoalbilbmmfgbnbgppjihopabppdk/inject.css" type="text/css" rel="stylesheet"></head><body id="svg-section" style="width: 600px; height: 337.5px; transform-origin: left top; transform: scale(1); overflow: auto;" class="vsc-initialized"><div class="pic-container">
<section>
<h2>見出し1</h2>
<p>最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。最初のコンテンツがここに入ります。</p>
</section>
<section>
<h2>見出し2</h2>
<p>2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。2番目のコンテンツがここに入ります。</p>
</section>
<section>
<h2>見出し3</h2>
<p>3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。3番目のコンテンツがここに入ります。</p>
</section>
</div>
</body></html>
一行追加するだけ。スムーズにスクロールできるCSSプロパティ
「scroll-behavior: smooth;」を指定するとスムーズにスクロールされます。
<html style="max-height: 100%;"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="ie=edge"><style id="basic-style">body,#svg-section{font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body,svg{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}</style><style id="root-style">:root{--pic-image-data:none;}</style><style id="out-style">.pic-container {
width: 100vw;
height: 100vh;
box-sizing: border-box;
background-color: white;
padding: 2rem;
}
nav {
display: flex;
gap: 0.5rem;
background-color: #fff;
padding: 1rem;
}
.contents {
/* スムーズスクロール */
scroll-behavior: smooth;
overflow-y: auto;
height: 200px;
}
section {
height: 200px;
display: grid;
place-items: center;
}
section:nth-of-type(1) {
background-color: #43a4d8;
}
section:nth-of-type(2) {
background-color: #81d644;
}
section:nth-of-type(3) {
background-color: #d65c44;
}
h2 {
color: #fff;
}
</style><style id="pic-style"></style><style id="body-style">body,#svg-section {font-family:-apple-system,BlinkMacSystemFont,'Helvetica Neue','游ゴシック Medium',YuGothic,YuGothicM,'Hiragino Kaku Gothic ProN',メイリオ,Meiryo,sans-serif;}</style><link href="chrome-extension://nffaoalbilbmmfgbnbgppjihopabppdk/inject.css" type="text/css" rel="stylesheet"></head><body id="svg-section" style="width: 600px; height: 337.5px; transform-origin: left top; transform: scale(1); overflow: auto;" class="vsc-initialized"><div class="pic-container">
<nav>
<a href="#section1">コンテンツ1</a>
<a href="#section2">コンテンツ2</a>
<a href="#section3">コンテンツ3</a>
</nav>
<div class="contents">
<section id="section1">
<h2>コンテンツ1</h2>
</section>
<section id="section2">
<h2>コンテンツ2</h2>
</section>
<section id="section3">
<h2>コンテンツ3</h2>
</section>
</div>
</div>
</body></html>