TEST-web-siteの3のcssコーディング

TEST 3のコーディングです。min-widthでレスポンシブルを作成!参考にできます

cssのノーマライズの部分

@charset "UTF-8";
/* CSSのnormalize */

/*html&bodyの設定*/
html {
  font-size: 62.5%; /* 1rem = 10px */
  overflow-y: scroll;
  overflow-x: hidden;
}

body {
  font-family: "YakuHanJPs_Noto", "Roboto", "Noto Sans JP", "游ゴシック Medium",
    "游ゴシック体", "Yu Gothic Medium", "YuGothic", "ヒラギノ角ゴ ProN",
    "Hiragino Kaku Gothic ProN", "メイリオ", "Meiryo", "MS Pゴシック",
    "MS PGothic", sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.8;
  width: 100%;
}

/* Box Sizing の設定 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* - -  h1.h2.h3....  - - */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: bold;
  color: #000;
  overflow-wrap: break-word;
}

/* -- a -- */
a {
  text-decoration: none;
  outline: none;
  color: #000;
}

a,
a > img {
  -webkit-transition: 0.2s;
  -moz-transition: 0.2s;
  -ms-transition: 0.2s;
  -o-transition: 0.2s;
  transition: 0.2s;
}

/* -- img -- */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* -- ul -- */
ul {
  list-style: none;
}
li {
  list-style: none;
}

/* -- :hover -- */
a:hover,
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  cursor: pointer;
}

/* -- inputの設定 --*/
input[type="text"] {
  font-size: 1rem;
}
input[type="submit"] {
  padding: 8px;
  border: #efefef;
  color: #000;
  background-color: aliceblue;
}

/*--  フォーム要素の設定  --*/
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  margin: 0;
}
button {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

/*--テーブルのborder-collapse*/
table {
  border-collapse: collapse;
  border-spacing: 0;
}


cssのstyleの部分

@charset "utf-8";

/*---------------rootの基本設定---------------*/
:root {
  /* カラーパレット */
  --primary-color: #3498db;
  --secondary-color: #2ecc71;
  --bg-beige: #f3f0e8;
  --text-color: #222222;
  --white--: #ffffff;
  --gold--: #b49f68;
  --black--: #000000;
  --footer-bg: #222222;
  --btn-color: #454545;
  --buy-btn-color: #ff0000;

  /* フォントサイズ */
  --font-small: 12px; /* 12px */
  --font-medium: 16px; /* 16px */
  --font-large: 20px; /* 20px */

  /* スペーシング */
  --spacing-small: 8px;
  --spacing-medium: 16px;
  --spacing-large: 24px;
}
/*---------------設定終了---------------*/

/*---------------デバイス別表示・非表示---------------*/
/* PC専用(769px以上で表示) */
.pc-only {
  display: block;
}
@media screen and (max-width: 768px) {
  .pc-only {
    display: none !important;
  }
}

/* タブレット専用(768px〜1024px) */
.tablet-only {
  display: none;
}
@media screen and (min-width: 768px) and (max-width: 1024px) {
  .tablet-only {
    display: block;
  }
}

/* スマホ専用(576px以下で表示) */
.sp-only {
  display: none;
}
@media screen and (max-width: 576px) {
  .sp-only {
    display: block !important;
  }
}

/* モバイル専用(1023px or 768px以下で表示:タブレット+スマホ) */
.mobile-only {
  display: none;
}
@media screen and (max-width: 1023px) {
  .mobile-only {
    display: block !important;
  }
}
/*---------------デバイス別表示・非表示の設定終了---------------*/

/*---------------全体のフォント設定---------------*/
body {
  font-family: "Noto Serif JP", "Helvetica Neue", Arial, sans-serif;
}
/*---------------全体のフォント設定終了---------------*/


cssのheader.cssの部分

@charset "UTF-8";

.site-header {
  width: 100%;
  background: #fff;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 80px;
  margin: 0 auto;
  padding: 20px;
}

.logo-area {
  display: flex;
  align-items: center;
}

.logo-img {
  height: 40px;
}

.main-nav {
  display: none;
}

/*spのハンバーガーメニュー*/
.openbtn {
  display: block;
  position: fixed;
  z-index: 4000;
  /*ボタンを最前面に*/
  top: 15px;
  right: 20px;
  cursor: pointer;
  width: 30px;
  height: 20px;
}
.openbtn span {
  display: inline-block;
  transition: all 0.4s;
  position: absolute;
  left: 14px;
  height: 3px;
  border-radius: 2px;
  background-color: #000;
  width: 80%;
  height: 2px;
}
.openbtn span:nth-of-type(1) {
  top: 15px;
}
.openbtn span:nth-of-type(2) {
  top: 23px;
}
.openbtn span:nth-of-type(3) {
  top: 31px;
}
.openbtn.active span:nth-of-type(1) {
  top: 18px;
  left: 18px;
  transform: translateY(6px) rotate(-45deg);
  width: 80%;
}
.openbtn.active span:nth-of-type(2) {
  opacity: 0;
}
.openbtn.active span:nth-of-type(3) {
  top: 30px;
  left: 18px;
  transform: translateY(-6px) rotate(45deg);
  width: 80%;
}
/*========= ナビゲーションのためのCSS ===============*/
#g-nav {
  display: block;
  /*position:fixed;にし、z-indexの数値を大きくして前面へ*/
  position: fixed;
  z-index: 3000;
  /*ナビのスタート位置と形状*/
  top: 0;
  right: -120%;
  width: 60%;
  /*半分とか調整をする際は、g-nav-listも合わせる*/
  height: 100dvh;
  /*ナビの高さ - dvhを使用してモバイルブラウザのUIを考慮*/
  background: #fff;
  /*動き*/
  transition: all 0.6s;
}
#g-nav.panelactive {
  right: 0;
}
#g-nav.panelactive #g-nav-list {
  /*ナビの数が増えた場合縦スクロール*/
  position: fixed;
  z-index: 3000;
  width: 60%;
  /*半分とか調整をする際は、g-navも合わせる*/
  height: 100dvh;
  /*表示する高さ - dvhを使用*/
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
#g-nav ul {
  /*ナビゲーション天地中央揃え*/
  position: absolute;
  width: 100%;
  z-index: 3000;
  margin-top: 100px;
  padding-left: 20px;
}
#g-nav ul .sns-wrapper {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  margin-left: 10px;
}
#g-nav ul .sns-wrapper .x-logo a img {
  width: 20px;
  height: 20px;
}
#g-nav ul .sns-wrapper .insta-logo a img {
  width: 25px;
  height: 25px;
}
#g-nav li {
  font-size: 1.5rem;
  list-style: none;
  text-align: left;
  padding-inline: 20px; /* 左右の余白 */
}
#g-nav li li:not(:first-child) {
  margin-top: 20px;
}
#g-nav li a {
  color: #000;
  text-decoration: none;
  padding: 10px 0; /* 上下のみpadding */
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid #ddd; /* 下線を左右端べったりじゃなく余白を持たせる */
}
/*---------------navi内のボタンの設定---------------*/
/*ボタン設定*/
.g_nav_btn {
  width: 80%;
  margin: 50px auto;
}
.g_nav_btn_link {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: min(2.08vw, 16px);
  padding-bottom: min(2.08vw, 16px);
  padding-left: min(1.3vw, 10px);
  padding-right: min(1.3vw, 10px);
  font-size: min(3.72vw, 16px);
  font-style: normal;
  font-weight: 700;
  line-height: 1.5;
  border-radius: min(0.78vw, 6px);
  transition: all 0.3s ease;
  background-color: var(--btn-color);
  color: var(--white--);
}
/* オーバーレイのスタイル */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 1500;
}

#overlay.active {
  opacity: 1;
  visibility: visible;
}
/* スクロール制御(メディアクエリ外に配置) */
html.no-scroll,
html.no-scroll body {
  overflow: hidden;
}

/*---------------header設定終了---------------*/

@media screen and (min-width: 1023px) {
  .main-nav {
    display: flex;
    align-items: center;
  }

  .main-nav ul {
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
  }

  .main-nav li {
    list-style: none;
  }

  .main-nav a {
    color: #222;
    font-size: 1.6rem;
    padding: 4px 0;
    text-decoration: none;
  }

  /*ボタン設定*/
  .main_btn {
    width: 100%;
    margin-left: 30px;
  }

  .main_btn a {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-block: 16px;
    padding-inline: 50px;
    font-size: min(1.11vw, 16px);
    font-style: normal;
    font-weight: 700;
    line-height: 1.5;
    border-radius: min(0.78vw, 6px);
    transition: all 0.3s ease;
    background-color: var(--btn-color);
    color: var(--white--);
  }

  .main_btn:hover {
    opacity: 0.8;
  }

  .openbtn {
    display: none;
  }
}

@media screen and (max-width: 300px) {
  .logo-img {
    max-width: 60%;
    height: 40px;
  }
  /* 画像も縮小対応 */
  .main_visual img {
    height: 100%;
    object-fit: cover;
  }
  .site-header {
    height: 48px;
    padding: 0;
  }
  .header-inner {
    padding: 8px;
  }
  .logo-img {
    max-width: 50%;
    height: 28px;
  }
  .openbtn {
    top: 8px;
    right: 30px;
    width: 24px;
    height: 16px;
  }
  .openbtn span {
    left: 6px;
    height: 2px;
    width: 70%;
  }
  .openbtn span:nth-of-type(1) {
    top: 6px;
  }
  .openbtn span:nth-of-type(2) {
    top: 10px;
  }
  .openbtn span:nth-of-type(3) {
    top: 14px;
  }
  .main-nav ul {
    gap: 8px;
  }
  .main-nav li {
    font-size: 1rem;
    padding-inline: 8px;
  }
  .main-nav a {
    font-size: 1rem;
    padding: 2px 0;
  }
  #g-nav {
    width: 90%;
    height: 100dvh;
    font-size: 1rem;
  }
  #g-nav ul {
    margin-top: 48px;
    padding-left: 8px;
  }
  #g-nav li {
    font-size: 1rem;
    padding-inline: 8px;
  }
  #g-nav li a {
    padding: 6px 0;
    font-size: 1rem;
  }
  .g_nav_btn {
    width: 90%;
    margin: 20px auto;
  }
  .g_nav_btn_link {
    font-size: 0.9rem;
    padding: 6px 8px;
  }
  #overlay {
    height: 100dvh;
  }
}


cssのmv.cssの部分

@charset "UTF-8";

.main_visual {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: flex-end; /* 下寄せ */
  flex-direction: column;
  align-items: center; /* 中央寄せ */
}
/*ボタン設定*/
.detail_btn {
  position: absolute;
  max-width: 240px;
  width: auto;
  bottom: 3%; /* 下からの余白を調整 */
  z-index: 2;
}
.detail_btn_link {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-block: min(2.27vw, 10px);
  padding-inline: min(11.36vw, 50px);
  font-size: min(5.45vw, 24px);
  font-style: normal;
  font-weight: bold;
  letter-spacing: 10%;
  border-radius: min(0.78vw, 6px);
  transition: all 0.3s ease;
  background-color: var(--btn-color);
  color: var(--white--);
}

@media screen and (min-width: 1023px) {
  .main_visual {
    width: 100%;
    aspect-ratio: 2 / 1; /* 2:1の比率で1440pxなら720px */
    max-height: 920px; /* 最大920pxに制限 */
    overflow: hidden;
    position: relative;
    align-items: flex-start; /* 左寄せ */
  }

  .main_visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
  }

  /*ボタン設定*/
  .detail_btn {
    position: static; /* absoluteを外す */
    margin-top: -9%; /* bottomからの余白を調整 */
    margin-left: 9%; /* 左右中央寄せ */
    width: min(21.94vw, 316px) !important;
    max-width: min(21.94vw, 316px) !important;
    z-index: 2;
  }
  .detail_btn_link {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-block: min(1.11vw, 16px);
    padding-inline: min(3.47vw, 50px);
    font-size: min(1.66vw, 24px);
    font-style: normal;
    font-weight: bold;
    letter-spacing: 10%;
    border-radius: min(0.78vw, 6px);
    transition: all 0.3s ease;
    background-color: var(--btn-color);
    color: var(--white--);
  }
  .detail_btn:hover {
    opacity: 0.8;
  }
}

@media screen and (max-width: 300px) {
  .main_visual {
    height: 200px; /* 高さを縮小 */
  }
  .detail_btn {
    min-width: 80px;
    max-width: 90%;
    bottom: -5%; /* 下からの余白を調整 */
  }
  .detail_btn_link {
    font-size: clamp(8px, 4vw, 24px);
    padding: 6px 8px;
  }
  /* 画像も縮小対応 */
  .main_visual img {
    height: 100%;
    object-fit: cover;
  }
}


cssのproductの部分

@charset "utf-8";

.product_section {
  width: 100%;
  margin-top: 100px;
}

.section_inner {
  width: 100%;
  margin: 0 auto;
  padding: 0 40px;
}

.section_title {
  font-size: min(5.45vw, 24px);
  font-weight: bold;
  text-align: left;
  position: relative;
  display: flex;
  align-items: center;
  margin-left: 20px;
}

.section_title::after {
  content: "";
  display: block;
  height: 1px;
  background: var(--text-color);
  margin-left: 16px;
  min-width: 50px;
  max-width: 100%;
}

/* 横スクロールテキスト */
.scrool_text {
  font-size: 14px;
  margin-top: 8px;
  margin-bottom: 12px;
  color: var(--text-color);
  text-align: right;
}
.scrool_text::after {
  content: "→";
  display: inline-block;
  margin-left: 5px;
  animation: scrollArrow 0.8s infinite alternate;
}
@keyframes scrollArrow {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 1;
    transform: translateX(5px);
  }
}

/* 商品リスト */
.product_items {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 16px;
  padding: 20px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE, Edge */
}

.product_items::-webkit-scrollbar {
  display: none;
}

.product_items > * {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.product_item {
  width: min(72.72vw, 320px);
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: var(--white--);
}

.product_item img {
  width: 200px;
  height: 150px;
  display: block;
  margin: 0 auto;
}

.pr_text_wrapper {
  width: 100%;
}

.pr_name {
  font-size: min(4.54vw, 20px);
  font-weight: bold;
  margin-top: 12px;
  margin-bottom: 20px;
  color: var(--text-color);
}

.pr_description {
  font-size: min(3.63vw, 16px);
  color: var(--text-color);
  margin-bottom: 20px;
}

.pr_description span {
  font-weight: bold;
}

.pr_price {
  font-size: min(5.45vw, 24px);
  font-weight: bold;
  color: var(--buy-btn-color);
}

.pr_price span {
  font-size: 12px;
}

/*ボタン設定*/
/*ボタン設定*/
.buy_btn {
  width: 200px;
  height: 45px;
  margin: 0 auto;
  margin-bottom: 20px;
}
.buy_btn_link {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-block: 10px;
  padding-inline: 30px;
  font-size: min(4.54vw, 20px);
  font-style: normal;
  font-weight: bold;
  letter-spacing: 10%;
  border-radius: min(0.78vw, 6px);
  transition: all 0.3s ease;
  background-color: var(--btn-color);
  color: var(--white--);
}

@media screen and (min-width: 1023px) {
  .section_title {
    font-size: min(3.33vw, 48px);
  }
  .section_title::after {
    min-width: 100px;
  }
  .product_section {
    width: 100%;
    margin-top: 100px;
  }
  .section_inner {
    width: 1000px;
    padding-inline: 10px;
    padding-block: 30px;
  }
  /* 商品リスト */
  .product_items {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: hidden;
  }
}

@media screen and (min-width: 1440px) {
  .product_section {
    width: 100%;
    margin-top: 100px;
  }
  .section_inner {
    width: 1280px;
    padding-inline: 100px;
    padding-block: 30px;
  }
  /* 商品リスト */
  .product_items {
    gap: 50px;
  }
}

/* --- 横スクロールをマウスドラッグでも可能にするJSを併用してください ---
例:
const slider = document.querySelector('.product_items');
let isDown = false;
let startX;
let scrollLeft;
slider.addEventListener('mousedown', (e) => {
  isDown = true;
  slider.classList.add('active');
  startX = e.pageX - slider.offsetLeft;
  scrollLeft = slider.scrollLeft;
});
slider.addEventListener('mouseleave', () => {
  isDown = false;
  slider.classList.remove('active');
});
slider.addEventListener('mouseup', () => {
  isDown = false;
  slider.classList.remove('active');
});
slider.addEventListener('mousemove', (e) => {
  if (!isDown) return;
  e.preventDefault();
  const x = e.pageX - slider.offsetLeft;
  const walk = (x - startX) * 1.5; // スクロール速度調整
  slider.scrollLeft = scrollLeft - walk;
});
--- */


サイトは

こちらから