Skip to content

CSS: responsive

[class*="-hidden-"],[class*="-show-"] — คลาสสำหรับแสดง/ซ่อนตามความกว้างของ viewport หรือ container โดยใช้มาตราส่วน breakpoint ที่มีธีม

.instui-hidden-max-<bp>/-hidden-min-<bp> ซ่อนตามความกว้างของ viewport; .instui-show-max-<bp>/-show-min-<bp> เป็นแบบตรงกันข้าม (ถูกซ่อนตามค่าเริ่มต้น และจะแสดงเฉพาะภายในช่วงผ่าน display: revert); ชุดตัวแปร -cq- ตอบสนองต่อความกว้างของ ancestor แบบ .instui-container แทนที่จะเป็น viewport ช่วงระดับสเกล xs/sm/md/lg/xl (มาจาก token ของ component tray-width ใน IR) แต่ละระดับมีชื่อยาวที่เป็นนามแฝง (x-smallx-large) และชื่ออุปกรณ์ (mobile/phablet/tablet/laptop/desktop) — ทั้งสองถูกเลิกใช้ zug ให้ใช้ชื่อสั้นแทน — รวมทั้งระดับไม่ปรับสเกลที่มีธีม content/content-full-width (max-width ของพื้นที่เนื้อหาหลัก)

Source: index.ts

การใช้งาน

css
@import "@pantoken/components/utilities.css";

ตัวอย่าง

html
<div class="instui-hidden-max-sm">Hidden at or below the small breakpoint.</div>
<div class="instui-show-min-sm">Shown only at or above the small breakpoint.</div>

ตัวปรับแต่ง

ตัวปรับแต่งคำอธิบาย
.-cq-hidden-max-contentซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า breakpoint content (68.75em)
.-cq-hidden-max-content-full-widthซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า breakpoint content-full-width (98.75em)
.-cq-hidden-max-desktopAlias — maps to .-cq-hidden-max-xl.
.-cq-hidden-max-laptopAlias — maps to .-cq-hidden-max-lg.
.-cq-hidden-max-largeAlias — maps to .-cq-hidden-max-lg.
.-cq-hidden-max-lgซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า breakpoint lg (48em)
.-cq-hidden-max-mdซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า breakpoint md (30em)
.-cq-hidden-max-mediumAlias — maps to .-cq-hidden-max-md.
.-cq-hidden-max-mobileAlias — maps to .-cq-hidden-max-xs.
.-cq-hidden-max-phabletAlias — maps to .-cq-hidden-max-sm.
.-cq-hidden-max-smซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า breakpoint sm (20em)
.-cq-hidden-max-smallAlias — maps to .-cq-hidden-max-sm.
.-cq-hidden-max-tabletAlias — maps to .-cq-hidden-max-md.
.-cq-hidden-max-x-largeAlias — maps to .-cq-hidden-max-xl.
.-cq-hidden-max-x-smallAlias — maps to .-cq-hidden-max-xs.
.-cq-hidden-max-xlซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า breakpoint xl (62em)
.-cq-hidden-max-xsซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า breakpoint xs (16em)
.-cq-hidden-min-contentซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า breakpoint content (68.75em)
.-cq-hidden-min-content-full-widthซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า breakpoint content-full-width (98.75em)
.-cq-hidden-min-desktopAlias — maps to .-cq-hidden-min-xl.
.-cq-hidden-min-laptopAlias — maps to .-cq-hidden-min-lg.
.-cq-hidden-min-largeAlias — maps to .-cq-hidden-min-lg.
.-cq-hidden-min-lgซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า breakpoint lg (48em)
.-cq-hidden-min-mdซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า breakpoint md (30em)
.-cq-hidden-min-mediumAlias — maps to .-cq-hidden-min-md.
.-cq-hidden-min-mobileAlias — maps to .-cq-hidden-min-xs.
.-cq-hidden-min-phabletAlias — maps to .-cq-hidden-min-sm.
.-cq-hidden-min-smซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า breakpoint sm (20em)
.-cq-hidden-min-smallAlias — maps to .-cq-hidden-min-sm.
.-cq-hidden-min-tabletAlias — maps to .-cq-hidden-min-md.
.-cq-hidden-min-x-largeAlias — maps to .-cq-hidden-min-xl.
.-cq-hidden-min-x-smallAlias — maps to .-cq-hidden-min-xs.
.-cq-hidden-min-xlซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า breakpoint xl (62em)
.-cq-hidden-min-xsซ่อนเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า breakpoint xs (16em)
.-cq-show-max-contentแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า content (68.75em); ซ่อนในกรณีอื่น
.-cq-show-max-content-full-widthแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า content-full-width (98.75em); ซ่อนในกรณีอื่น
.-cq-show-max-desktopAlias — maps to .-cq-show-max-xl.
.-cq-show-max-laptopAlias — maps to .-cq-show-max-lg.
.-cq-show-max-largeAlias — maps to .-cq-show-max-lg.
.-cq-show-max-lgแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า lg (48em); ซ่อนในกรณีอื่น
.-cq-show-max-mdแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า md (30em); ซ่อนในกรณีอื่น
.-cq-show-max-mediumAlias — maps to .-cq-show-max-md.
.-cq-show-max-mobileAlias — maps to .-cq-show-max-xs.
.-cq-show-max-phabletAlias — maps to .-cq-show-max-sm.
.-cq-show-max-smแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า sm (20em); ซ่อนในกรณีอื่น
.-cq-show-max-smallAlias — maps to .-cq-show-max-sm.
.-cq-show-max-tabletAlias — maps to .-cq-show-max-md.
.-cq-show-max-x-largeAlias — maps to .-cq-show-max-xl.
.-cq-show-max-x-smallAlias — maps to .-cq-show-max-xs.
.-cq-show-max-xlแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า xl (62em); ซ่อนในกรณีอื่น
.-cq-show-max-xsแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือต่ำกว่า xs (16em); ซ่อนในกรณีอื่น
.-cq-show-min-contentแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า content (68.75em); ซ่อนในกรณีอื่น
.-cq-show-min-content-full-widthแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า content-full-width (98.75em); ซ่อนในกรณีอื่น
.-cq-show-min-desktopAlias — maps to .-cq-show-min-xl.
.-cq-show-min-laptopAlias — maps to .-cq-show-min-lg.
.-cq-show-min-largeAlias — maps to .-cq-show-min-lg.
.-cq-show-min-lgแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า lg (48em); ซ่อนในกรณีอื่น
.-cq-show-min-mdแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า md (30em); ซ่อนในกรณีอื่น
.-cq-show-min-mediumAlias — maps to .-cq-show-min-md.
.-cq-show-min-mobileAlias — maps to .-cq-show-min-xs.
.-cq-show-min-phabletAlias — maps to .-cq-show-min-sm.
.-cq-show-min-smแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า sm (20em); ซ่อนในกรณีอื่น
.-cq-show-min-smallAlias — maps to .-cq-show-min-sm.
.-cq-show-min-tabletAlias — maps to .-cq-show-min-md.
.-cq-show-min-x-largeAlias — maps to .-cq-show-min-xl.
.-cq-show-min-x-smallAlias — maps to .-cq-show-min-xs.
.-cq-show-min-xlแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า xl (62em); ซ่อนในกรณีอื่น
.-cq-show-min-xsแสดงเมื่อ container ที่ทำเครื่องหมายมีความกว้างเท่าหรือมากกว่า xs (16em); ซ่อนในกรณีอื่น
.-hidden-max-contentซ่อนเมื่อ viewport มีความกว้างเท่าหรือต่ำกว่า breakpoint content (68.75em)
.-hidden-max-content-full-widthซ่อนเมื่อ viewport มีความกว้างเท่าหรือต่ำกว่า breakpoint content-full-width (98.75em)
.-hidden-max-desktopAlias — maps to .-hidden-max-xl.
.-hidden-max-laptopAlias — maps to .-hidden-max-lg.
.-hidden-max-largeAlias — maps to .-hidden-max-lg.
.-hidden-max-lgซ่อนเมื่อ viewport มีความกว้างเท่าหรือต่ำกว่า breakpoint lg (48em)
.-hidden-max-mdซ่อนเมื่อ viewport มีความกว้างเท่าหรือต่ำกว่า breakpoint md (30em)
.-hidden-max-mediumAlias — maps to .-hidden-max-md.
.-hidden-max-mobileAlias — maps to .-hidden-max-xs.
.-hidden-max-phabletAlias — maps to .-hidden-max-sm.
.-hidden-max-smซ่อนเมื่อ viewport มีความกว้างเท่าหรือต่ำกว่า breakpoint sm (20em)
.-hidden-max-smallAlias — maps to .-hidden-max-sm.
.-hidden-max-tabletAlias — maps to .-hidden-max-md.
.-hidden-max-x-largeAlias — maps to .-hidden-max-xl.
.-hidden-max-x-smallAlias — maps to .-hidden-max-xs.
.-hidden-max-xlซ่อนเมื่อ viewport มีความกว้างเท่าหรือต่ำกว่า breakpoint xl (62em)
.-hidden-max-xsซ่อนเมื่อ viewport มีความกว้างเท่าหรือต่ำกว่า breakpoint xs (16em)
.-hidden-min-contentซ่อนเมื่อ viewport มีความกว้างเท่าหรือมากกว่า breakpoint content (68.75em)
.-hidden-min-content-full-widthซ่อนเมื่อ viewport มีความกว้างเท่าหรือมากกว่า breakpoint content-full-width (98.75em)
.-hidden-min-desktopAlias — maps to .-hidden-min-xl.
.-hidden-min-laptopAlias — maps to .-hidden-min-lg.
.-hidden-min-largeAlias — maps to .-hidden-min-lg.
.-hidden-min-lgซ่อนเมื่อ viewport มีความกว้างเท่าหรือมากกว่า breakpoint lg (48em)
.-hidden-min-mdซ่อนเมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint md (30em).
.-hidden-min-mediumAlias — maps to .-hidden-min-md.
.-hidden-min-mobileAlias — maps to .-hidden-min-xs.
.-hidden-min-phabletAlias — maps to .-hidden-min-sm.
.-hidden-min-smซ่อนเมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint sm (20em).
.-hidden-min-smallAlias — maps to .-hidden-min-sm.
.-hidden-min-tabletAlias — maps to .-hidden-min-md.
.-hidden-min-x-largeAlias — maps to .-hidden-min-xl.
.-hidden-min-x-smallAlias — maps to .-hidden-min-xs.
.-hidden-min-xlซ่อนเมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint xl (62em).
.-hidden-min-xsซ่อนเมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint xs (16em).
.-show-max-contentแสดง (ตรงข้ามกับ -hidden-min-content) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือต่ำกว่า breakpoint content (68.75em); ซ่อนในกรณีอื่น ๆ.
.-show-max-content-full-widthแสดง (ตรงข้ามกับ -hidden-min-content-full-width) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือต่ำกว่า breakpoint content-full-width (98.75em); ซ่อนในกรณีอื่น ๆ.
.-show-max-desktopAlias — maps to .-show-max-xl.
.-show-max-laptopAlias — maps to .-show-max-lg.
.-show-max-largeAlias — maps to .-show-max-lg.
.-show-max-lgแสดง (ตรงข้ามกับ -hidden-min-lg) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือต่ำกว่า breakpoint lg (48em); ซ่อนในกรณีอื่น ๆ.
.-show-max-mdแสดง (ตรงข้ามกับ -hidden-min-md) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือต่ำกว่า breakpoint md (30em); ซ่อนในกรณีอื่น ๆ.
.-show-max-mediumAlias — maps to .-show-max-md.
.-show-max-mobileAlias — maps to .-show-max-xs.
.-show-max-phabletAlias — maps to .-show-max-sm.
.-show-max-smแสดง (ตรงข้ามกับ -hidden-min-sm) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือต่ำกว่า breakpoint sm (20em); ซ่อนในกรณีอื่น ๆ.
.-show-max-smallAlias — maps to .-show-max-sm.
.-show-max-tabletAlias — maps to .-show-max-md.
.-show-max-x-largeAlias — maps to .-show-max-xl.
.-show-max-x-smallAlias — maps to .-show-max-xs.
.-show-max-xlแสดง (ตรงข้ามกับ -hidden-min-xl) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือต่ำกว่า breakpoint xl (62em); ซ่อนในกรณีอื่น ๆ.
.-show-max-xsแสดง (ตรงข้ามกับ -hidden-min-xs) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือต่ำกว่า breakpoint xs (16em); ซ่อนในกรณีอื่น ๆ.
.-show-min-contentแสดง (ตรงข้ามกับ -hidden-max-content) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint content (68.75em); ซ่อนในกรณีอื่น ๆ.
.-show-min-content-full-widthแสดง (ตรงข้ามกับ -hidden-max-content-full-width) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint content-full-width (98.75em); ซ่อนในกรณีอื่น ๆ.
.-show-min-desktopAlias — maps to .-show-min-xl.
.-show-min-laptopAlias — maps to .-show-min-lg.
.-show-min-largeAlias — maps to .-show-min-lg.
.-show-min-lgแสดง (ตรงข้ามกับ -hidden-max-lg) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint lg (48em); ซ่อนในกรณีอื่น ๆ.
.-show-min-mdแสดง (ตรงข้ามกับ -hidden-max-md) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint md (30em); ซ่อนในกรณีอื่น ๆ.
.-show-min-mediumAlias — maps to .-show-min-md.
.-show-min-mobileAlias — maps to .-show-min-xs.
.-show-min-phabletAlias — maps to .-show-min-sm.
.-show-min-smแสดง (ตรงข้ามกับ -hidden-max-sm) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint sm (20em); ซ่อนในกรณีอื่น ๆ.
.-show-min-smallAlias — maps to .-show-min-sm.
.-show-min-tabletAlias — maps to .-show-min-md.
.-show-min-x-largeAlias — maps to .-show-min-xl.
.-show-min-x-smallAlias — maps to .-show-min-xs.
.-show-min-xlแสดง (ตรงข้ามกับ -hidden-max-xl) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint xl (62em); ซ่อนในกรณีอื่น ๆ.
.-show-min-xsแสดง (ตรงข้ามกับ -hidden-max-xs) เมื่อขนาดหน้าต่างแสดงผล (viewport) อยู่ที่หรือสูงกว่า breakpoint xs (16em); ซ่อนในกรณีอื่น ๆ.

พร็อพเพอร์ตีที่กำหนดเอง

คุณสมบัติชนิดค่าเริ่มต้นคำอธิบาย
--pantoken-bp-content<length>68.75emค่าของ breakpoint content (68.75em, เขียนด้วยมือ, ธีมแล้ว (ไม่รวมใน token IR)). การ override ค่านี้จะไม่ทำให้เกณฑ์ที่คอมไพล์แล้ว @media/@container ขยับขึ้นไปสูงกว่า.
--pantoken-bp-content-full-width<length>98.75emค่าของ breakpoint content-full-width (98.75em, เขียนด้วยมือ, ธีมแล้ว (ไม่รวมใน token IR)). การ override ค่านี้จะไม่ทำให้เกณฑ์ที่คอมไพล์แล้ว @media/@container ขยับขึ้นไปสูงกว่า.
--pantoken-bp-lg<length>48emค่าของ breakpoint lg (48em, สะท้อนค่า --instui-component-tray-width-lg). การ override ค่านี้จะไม่ทำให้เกณฑ์ที่คอมไพล์แล้ว @media/@container ขยับขึ้นไปสูงกว่า.
--pantoken-bp-md<length>30emค่าของ breakpoint md (30em, สะท้อนค่า --instui-component-tray-width-md). การ override ค่านี้จะไม่ทำให้เกณฑ์ที่คอมไพล์แล้ว @media/@container ขยับขึ้นไปสูงกว่า.
--pantoken-bp-sm<length>20emค่าของ breakpoint sm (20em, สะท้อนค่า --instui-component-tray-width-sm). การ override ค่านี้จะไม่ทำให้เกณฑ์ที่คอมไพล์แล้ว @media/@container ขยับขึ้นไปสูงกว่า.
--pantoken-bp-xl<length>62emค่าของ breakpoint xl (62em, สะท้อนค่า --instui-component-tray-width-xl). การ override ค่านี้จะไม่ทำให้เกณฑ์ที่คอมไพล์แล้ว @media/@container ขยับขึ้นไปสูงกว่า.
--pantoken-bp-xs<length>16emค่าของ breakpoint xs (16em, สะท้อนค่า --instui-component-tray-width-xs). การ override ค่านี้จะไม่ทำให้เกณฑ์ที่คอมไพล์แล้ว @media/@container ขยับขึ้นไปสูงกว่า.

เงื่อนไข

ชนิดการค้นหาคำอธิบาย
media(max-width: 16em)ขอบบนของ breakpoint xs.
media(min-width: 16em)ขอบล่างของ breakpoint xs.
media(max-width: 20em)ขอบบนของ breakpoint sm.
media(min-width: 20em)ขอบล่างของ breakpoint sm.
media(max-width: 30em)ขอบบนของ breakpoint md.
media(min-width: 30em)ขอบล่างของ breakpoint md.
media(max-width: 48em)ขอบบนของ breakpoint lg.
media(min-width: 48em)ขอบล่างของ breakpoint lg.
media(max-width: 62em)ขอบบนของ breakpoint xl.
media(min-width: 62em)ขอบล่างของ breakpoint xl.
media(max-width: 68.75em)ขอบบนของ breakpoint content.
media(min-width: 68.75em)ขอบล่างของ breakpoint content.
media(max-width: 98.75em)ขอบบนของ breakpoint content-full-width.
media(min-width: 98.75em)ขอบล่างของ breakpoint content-full-width.
container(max-width: 16em)ขอบบนของ breakpoint xs ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย.
container(min-width: 16em)ขอบล่างของ breakpoint xs ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย.
container(max-width: 20em)ขอบบนของ breakpoint sm ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย.
container(min-width: 20em)ขอบล่างของ breakpoint sm ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย.
container(max-width: 30em)ขอบบนของ breakpoint md ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย
container(min-width: 30em)ขอบล่างของ breakpoint md ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย
container(max-width: 48em)ขอบบนของ breakpoint lg ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย
container(min-width: 48em)ขอบล่างของ breakpoint lg ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย
container(max-width: 62em)ขอบบนของ breakpoint xl ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย
container(min-width: 62em)ขอบล่างของ breakpoint xl ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย
container(max-width: 68.75em)ขอบบนของ breakpoint content ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย
container(min-width: 68.75em)ขอบล่างของ breakpoint content ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย
container(max-width: 98.75em)ขอบบนของ breakpoint content-full-width ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย
container(min-width: 98.75em)ขอบล่างของ breakpoint content-full-width ที่ถูกประเมินเทียบกับคอนเทนเนอร์ที่ถูกทำเครื่องหมาย

โทเค็นที่ใช้

Tokenชนิดค่า
--instui-component-tray-width-lg<length>48em
--instui-component-tray-width-md<length>30em
--instui-component-tray-width-sm<length>20em
--instui-component-tray-width-xl<length>62em
--instui-component-tray-width-xs<length>16em