テンプレート【Basics】のPC表示のヘッダーは、ほかのテンプレートと比べて高さがあるため、商品説明が長いショップ様では商品詳細ページの主要コンテンツが画面下に押し下げられて見えにくくなる場合があります。
商品詳細ページのみ、PC表示でもスマホ用のヘッダー(ハンバーガーメニュー型のすっきりしたレイアウト)を表示するようCSSを追記すると、ヘッダーの高さが抑えられ、商品画像や商品説明をすぐに確認できる見せ方に変えられます。
商品詳細ページにのみ適用するため、トップページやカテゴリーページなど他のページのヘッダーは変わりません。
編集前の注意
作業の前にバックアップを保管し、元の状態に戻せるように準備したうえで編集をおこなってください。
参考:【クリエイターモード】デザインセット(ソースコード)をバックアップする方法を教えてください。
ご対処
商品詳細ページの「CSS」欄の末尾に、PC表示時のみ適用されるCSS(@media (min-width: 769px))を追記し、PCのヘッダー要素にスマホ用のレイアウトを反映させます。
操作パス
ショップデザイン / テンプレート選択・編集 / クリエイターモード / 商品詳細「CSS」欄
ショップデザイン / テンプレート選択・編集 / クリエイターモード / 商品詳細「CSS」欄
上記の「CSS」欄の末尾に下記コードを追記し、保存してください。
追記例
/* PC商品詳細ページ スマホ用ヘッダー表示 */
@media (min-width: 769px) {
span.cart-badge {
top: -10px;
right: -14px;
}
.header{
width: 100%;
}
.header-wrap {
justify-content: center;
}
.shop-logo {
margin: 0;
}
.header-sns {
display: none;
}
.sns-link-list-sp {
display: flex;
padding-top: 20px;
}
.sns-link-list-sp .sns-link {
padding: 0 0 0 14px;
}
.nav, .second-nav {
display: none;
}
.side-bar {
display: none;
}
.banner-area li {
flex: 0 0 49%;
max-width: 49%;
margin-bottom: 1.6%;
}
.header-info {
flex-direction: column;
text-align: center !important;
}
.header-info dt, .header-info dd {
text-align: center !important;
}
.shop-logo span {
display: none;
}
#start-contents .contents-section {
margin: 0 auto;
}
/*------------------
hamburger
------------------*/
.wrapper {
height: 100%;
overflow-x: hidden;
position: relative;
display: block;
}
.sp-nav-wrap {
display: block;
}
.sp-nav-wrap a {
font-weight: 700;
}
.overlay {
content: "";
display: block;
width: 0;
height: 0;
background-color: rgba(0, 0, 0, 0.5) !important;
position: absolute;
top: 0;
left: 0;
z-index: 2;
opacity: 0;
transition: opacity .5s;
}
.overlay.open {
width: 100%;
height: 100%;
opacity: 1;
}
.menu-trigger {
display: inline-block;
width: 28px;
height: 28px;
vertical-align: middle;
cursor: pointer;
position: fixed;
top: 8px!important;
left: 16px;
z-index: 100;
}
.menu-trigger span {
display: inline-block;
box-sizing: border-box;
position: absolute;
left: 0;
width: 80%;
height: 4px;
background-color: #000;
transition: all .5s;
}
.menu-trigger.active span {
background-color: #000;
}
.menu-trigger span:nth-of-type(1) {
top: 4px;
}
.menu-trigger.active span:nth-of-type(1) {
transform: translateY(12px) rotate(-45deg);
}
.menu-trigger span:nth-of-type(2) {
top: 12px;
}
.menu-trigger.active span:nth-of-type(2) {
opacity: 0;
}
.menu-trigger span:nth-of-type(3) {
bottom: 4px;
}
.menu-trigger.active span:nth-of-type(3) {
transform: translateY(-4px) rotate(45deg);
}
nav {
width: 250px;
height: 100%;
padding-top: 100px;
background: #fff !important;
position: fixed;
top: 0;
left: 0;
z-index: 10;
transform: translate(-250px);
transition: all .5s;
}
nav.open {
transform: translate(0, 0);
overflow: scroll;
overflow-x: hidden;
width: 100%;
height: 100%;
}
nav li {
color: #000;
text-align: left;
padding: 10px 20px;
}
nav li a {
color: #000;
}
.accordion-container {
position: relative;
width: 100%;
cursor: pointer
}
.accordion-container .article-title {
display: block;
position: relative;
margin: 0;
font-weight: 700;
color: #000;
cursor: pointer;
}
.accordion-container .article-title:hover i:before,
.accordion-container .article-title:hover i:active,
.accordion-container .content-entry.open i {
color: white;
}
.article-title {
position: relative;
}
.article-title:after {
content: "";
position: absolute;
right: 16px;
top: 10%;
transition: all 0.2s ease-in-out;
display: block;
width: 8px;
height: 8px;
border-top: solid 2px #6E6E6E;
border-right: solid 2px #6E6E6E;
-webkit-transform: rotate(135deg);
transform: rotate(135deg);
}
.article-title.open:after {
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
top: 45%;
}
.accordion-content {
display: none;
padding: 24px 6px 0;
font-family: 'Noto Sans JP', sans-serif;
}
.accordion-content p {
position: relative;
padding-bottom: 20px;
margin-bottom: 20px;
display: block;
}
.accordion-content a {
position: absolute;
display: inline-block;
width: 100%;
height: 100%;
top: 0;
left: 0;
color: #000;
}
.accordion-container {
margin: 0;
}
dl.search1 {
position: relative;
background-color: #fff;
border-bottom: 1px solid #aaa;
}
dl.search1 dt {
padding: 12px 0px;
}
dl.search1 dt input {
border: none;
border-radius: 0;
outline: none;
background: none;
}
dl.search1 dd {
position: absolute;
top: 0;
right: 0;
}
dl.search1 dd button {
display: block;
padding: 10px;
background: none;
border: none;
}
dl.search1 dd button span {
display: block;
width: 20px;
height: 20px;
background: url('/view/images/template/6/search_icon.png') no-repeat scroll 0 0;
}
.search-link-sp {
margin-bottom: 16px;
}
.sp-second-nav-wrap {
display: flex;
position: absolute;
top: 13px;
right: 16px;
}
.cart-link {
margin-left: 16px;
}
.information-label {
margin: 0 0 8px 0;
}
/*------------------
detail
------------------*/
.item-inner {
margin-top: 100px;
}
.header-info {
flex-direction: unset;
}
.header-wrap {
padding: 3px;
}
.header-info {
padding: 5px;
}
.header-info dd {
margin-left: 5px;
}
.header-inner:first-child {
border:none;
}
}
補足
商品詳細ページの「CSS」欄に記述した内容は、商品詳細ページのみに適用されます。
トップページやカテゴリーページのヘッダーには影響しません。
なお、上記のCSSは商品詳細ページ用のCSSのため、他のページの「CSS」欄に記述した場合は崩れが発生します。


