Editor: pin the play area to the top in the single-column layout
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7bf38ae86a
commit
c8a2af1f1a
1 file changed
+37
-21
+37
-21
@@ -32,7 +32,7 @@
|
||||
header { padding: 20px 16px 4px; max-width: 1200px; margin: 0 auto; }
|
||||
h1 { margin: 0; font-size: 1.6rem; }
|
||||
header p { margin: 4px 0 0; color: var(--muted); }
|
||||
.layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 20px; max-width: 1200px; margin: 0 auto; padding: 16px; align-items: start; }
|
||||
.layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 0 20px; max-width: 1200px; margin: 0 auto; padding: 16px; align-items: start; }
|
||||
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 16px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
|
||||
.panel > summary { list-style: none; cursor: pointer; font-weight: 700; padding: 12px 0 8px; display: flex; justify-content: space-between; align-items: center; }
|
||||
.panel > summary::-webkit-details-marker { display: none; }
|
||||
@@ -57,6 +57,9 @@
|
||||
.note { font-size: .85rem; color: var(--muted); margin: 6px 0; }
|
||||
.warn { font-size: .85rem; color: var(--accent); margin: 6px 0; }
|
||||
main { min-width: 0; }
|
||||
.play-card { grid-column: 2; grid-row: 1; min-width: 0; }
|
||||
.panel { grid-column: 1; grid-row: 1 / span 2; }
|
||||
main { grid-column: 2; grid-row: 2; }
|
||||
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 20px; }
|
||||
.card h2 { margin: 0 0 8px; font-size: 1.15rem; }
|
||||
.play { min-height: 320px; position: relative; touch-action: pan-y; display: grid; place-items: center; text-align: center; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); padding: 20px; }
|
||||
@@ -71,9 +74,22 @@
|
||||
code { background: var(--code); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
|
||||
footer { max-width: 1200px; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: .85rem; }
|
||||
@media (max-width: 760px) {
|
||||
.layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; }
|
||||
.panel { position: static; max-height: none; }
|
||||
.play { min-height: 380px; }
|
||||
/* 聚焦設定欄位時不要被吸附的試玩區蓋住(只套在面板與輸出區,試玩區本身不受影響) */
|
||||
.panel :is(input, select, summary, button), main :is(input, textarea, button, a) { scroll-margin-top: calc(min(36vh, 300px) + 72px); scroll-margin-top: calc(min(36svh, 300px) + 72px); }
|
||||
.layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px 12px; }
|
||||
.play-card, .panel, main { grid-column: 1; grid-row: auto; }
|
||||
.panel { position: static; max-height: none; margin-bottom: 20px; }
|
||||
/* 單欄時試玩區吸附在畫面上方,往下調設定時一直看得到 */
|
||||
.play-card { position: sticky; top: 0; z-index: 20; margin: 0 -16px 16px; padding: 8px 16px 6px; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); box-shadow: 0 6px 14px -8px rgba(0,0,0,.35); }
|
||||
.play-card h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
|
||||
.play { min-height: 0; height: min(36vh, 300px); height: min(36svh, 300px); padding: 8px; font-size: .8rem; line-height: 1.5; }
|
||||
.play strong { font-size: .9rem; }
|
||||
.play .more { display: none; }
|
||||
.bgswitch { margin-top: 10px; gap: 10px; font-size: .8rem; }
|
||||
.bgswitch input { margin: 0 2px 0 0; vertical-align: -2px; }
|
||||
}
|
||||
@media (max-width: 760px) and (max-height: 560px) {
|
||||
.play { height: 200px; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -84,6 +100,23 @@
|
||||
</header>
|
||||
|
||||
<div class="layout">
|
||||
<section class="card play-card" id="playCard" aria-labelledby="playTitle">
|
||||
<h2 id="playTitle">試玩區</h2>
|
||||
<div class="play" id="play">
|
||||
<div>
|
||||
<strong>移動滑鼠,或用手指在畫面上滑動</strong>
|
||||
時鐘會跟著你。電腦在游標右下方,手機在手指上方。<br>
|
||||
<span class="more">這裡的時鐘只在框內預覽;放到你的網站上會跟著整個頁面移動。</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bgswitch" role="radiogroup" aria-label="預覽底色">
|
||||
<span>預覽底色:</span>
|
||||
<label><input type="radio" name="bg" value="auto" checked> 跟隨系統</label>
|
||||
<label><input type="radio" name="bg" value="light"> 淺色網站</label>
|
||||
<label><input type="radio" name="bg" value="dark"> 深色網站</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<details class="panel" id="panel" open>
|
||||
<summary>設定 <span class="hint" id="panelHint">點這裡收合</span></summary>
|
||||
|
||||
@@ -140,23 +173,6 @@
|
||||
</details>
|
||||
|
||||
<main>
|
||||
<section class="card" aria-labelledby="playTitle">
|
||||
<h2 id="playTitle">試玩區</h2>
|
||||
<div class="play" id="play">
|
||||
<div>
|
||||
<strong>移動滑鼠,或用手指在畫面上滑動</strong>
|
||||
時鐘會跟著你。電腦在游標右下方,手機在手指上方。<br>
|
||||
這裡的時鐘只在框內預覽;放到你的網站上會跟著整個頁面移動。
|
||||
</div>
|
||||
</div>
|
||||
<div class="bgswitch" role="radiogroup" aria-label="預覽底色">
|
||||
<span>預覽底色:</span>
|
||||
<label><input type="radio" name="bg" value="auto" checked> 跟隨系統</label>
|
||||
<label><input type="radio" name="bg" value="light"> 淺色網站</label>
|
||||
<label><input type="radio" name="bg" value="dark"> 深色網站</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card" aria-labelledby="outTitle">
|
||||
<h2 id="outTitle">取得程式碼</h2>
|
||||
<div class="tabs" role="tablist" aria-label="程式碼形式">
|
||||
|
||||
Reference in new issue
Block a user