2026-01-15 20:10:19 +08:00
|
|
|
|
<template>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
<div class="box-demo">
|
2026-02-14 12:14:07 +08:00
|
|
|
|
<div class="demo-header">
|
|
|
|
|
|
<span class="title">CSS 盒模型</span>
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<span class="subtitle">理解元素实际占用空间的构成</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="scenario">
|
|
|
|
|
|
<strong>场景:</strong>你要做三个并排卡片,容器宽度 900px,每个卡片设 width: 200px。结果第三个掉下去了——为什么?
|
2026-02-14 12:14:07 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<div class="main-area">
|
|
|
|
|
|
<div class="left-panel">
|
|
|
|
|
|
<div class="controls">
|
|
|
|
|
|
<div class="control-row">
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<label>width</label>
|
|
|
|
|
|
<input type="range" min="60" max="150" v-model.number="contentW" />
|
|
|
|
|
|
<span class="val">{{ contentW }}px</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="control-row">
|
|
|
|
|
|
<label>padding</label>
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<input type="range" min="0" max="30" v-model.number="padding" />
|
|
|
|
|
|
<span class="val">{{ padding }}px</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="control-row">
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<label>border</label>
|
|
|
|
|
|
<input type="range" min="0" max="15" v-model.number="border" />
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<span class="val">{{ border }}px</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="control-row">
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<label>margin</label>
|
|
|
|
|
|
<input type="range" min="0" max="20" v-model.number="margin" />
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<span class="val">{{ margin }}px</span>
|
|
|
|
|
|
</div>
|
2026-01-15 20:10:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<div class="box-sizing-toggle">
|
|
|
|
|
|
<span class="toggle-label">box-sizing:</span>
|
|
|
|
|
|
<button
|
|
|
|
|
|
:class="['toggle-btn', { active: boxSizing === 'content-box' }]"
|
|
|
|
|
|
@click="boxSizing = 'content-box'"
|
|
|
|
|
|
>
|
|
|
|
|
|
content-box
|
|
|
|
|
|
</button>
|
|
|
|
|
|
<button
|
|
|
|
|
|
:class="['toggle-btn', { active: boxSizing === 'border-box' }]"
|
|
|
|
|
|
@click="boxSizing = 'border-box'"
|
|
|
|
|
|
>
|
|
|
|
|
|
border-box
|
|
|
|
|
|
</button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<div class="visual">
|
|
|
|
|
|
<div class="layer margin" :style="{ padding: margin + 'px' }">
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<span class="layer-label" v-if="margin >= 8">margin</span>
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<div class="layer border" :style="{ borderWidth: border + 'px' }">
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<span class="layer-label" v-if="border >= 5">border</span>
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<div class="layer padding" :style="{ padding: padding + 'px' }">
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<span class="layer-label" v-if="padding >= 8">padding</span>
|
|
|
|
|
|
<div class="content" :style="{ width: contentW + 'px' }">
|
|
|
|
|
|
content<br>{{ contentW }}px
|
|
|
|
|
|
</div>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-01-15 20:10:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<div class="right-panel">
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<div class="result-card">
|
|
|
|
|
|
<div class="result-header">
|
|
|
|
|
|
<span class="result-title">实际占用宽度</span>
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<span class="result-value">{{ total }}px</span>
|
|
|
|
|
|
</div>
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<div class="formula">
|
|
|
|
|
|
<template v-if="boxSizing === 'content-box'">
|
|
|
|
|
|
{{ contentW }} + {{ padding }}×2 + {{ border }}×2 + {{ margin }}×2 = {{ total }}px
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
{{ contentW }}px(已包含 padding 和 border) + {{ margin }}×2 = {{ total }}px
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="result-hint" :class="{ warning: total * 3 > 900 }">
|
|
|
|
|
|
<template v-if="total * 3 > 900">
|
|
|
|
|
|
三个卡片需要 {{ total * 3 }}px,超出容器 900px,第三个会掉下去
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
|
|
|
|
|
三个卡片共 {{ total * 3 }}px,可以放下
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</div>
|
2026-01-15 20:10:19 +08:00
|
|
|
|
</div>
|
2026-02-14 20:23:34 +08:00
|
|
|
|
|
|
|
|
|
|
<div class="code-block">
|
|
|
|
|
|
<div class="code-title">CSS</div>
|
|
|
|
|
|
<div class="code-content">
|
|
|
|
|
|
<div class="line">.box {</div>
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<div class="line hl"> box-sizing: {{ boxSizing }};</div>
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<div class="line"> width: {{ contentW }}px;</div>
|
|
|
|
|
|
<div class="line"> padding: {{ padding }}px;</div>
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<div class="line"> border: {{ border }}px solid #ccc;</div>
|
2026-02-14 20:23:34 +08:00
|
|
|
|
<div class="line"> margin: {{ margin }}px;</div>
|
|
|
|
|
|
<div class="line">}</div>
|
|
|
|
|
|
</div>
|
2026-01-15 20:10:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-14 12:14:07 +08:00
|
|
|
|
<div class="info-box">
|
2026-02-14 22:48:56 +08:00
|
|
|
|
<strong>关键区别:</strong>
|
|
|
|
|
|
<code>content-box</code>(默认)的 width 只是内容宽度;
|
|
|
|
|
|
<code>border-box</code> 的 width 包含 content + padding + border。推荐全局设置 <code>box-sizing: border-box</code>。
|
2026-01-15 20:10:19 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { computed, ref } from 'vue'
|
|
|
|
|
|
|
2026-02-14 22:48:56 +08:00
|
|
|
|
const contentW = ref(100)
|
2026-02-14 20:23:34 +08:00
|
|
|
|
const padding = ref(15)
|
2026-02-14 22:48:56 +08:00
|
|
|
|
const border = ref(5)
|
|
|
|
|
|
const margin = ref(10)
|
|
|
|
|
|
const boxSizing = ref('content-box')
|
|
|
|
|
|
|
|
|
|
|
|
const total = computed(() => {
|
|
|
|
|
|
if (boxSizing.value === 'border-box') {
|
|
|
|
|
|
return contentW.value + margin.value * 2
|
|
|
|
|
|
}
|
|
|
|
|
|
return contentW.value + padding.value * 2 + border.value * 2 + margin.value * 2
|
|
|
|
|
|
})
|
2026-01-15 20:10:19 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.box-demo {
|
2026-01-15 20:10:19 +08:00
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
border-radius: 8px;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
background: var(--vp-c-bg-soft);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
padding: 1rem;
|
|
|
|
|
|
margin: 1rem 0;
|
2026-02-14 12:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.demo-header {
|
|
|
|
|
|
display: flex;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
gap: 0.25rem;
|
2026-02-14 12:14:07 +08:00
|
|
|
|
margin-bottom: 0.75rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.demo-header .title {
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
font-size: 1rem;
|
|
|
|
|
|
color: var(--vp-c-text-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.demo-header .subtitle {
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
font-size: 0.85rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.scenario {
|
|
|
|
|
|
background: var(--vp-c-warning-soft);
|
|
|
|
|
|
border: 1px solid var(--vp-c-warning-dimm);
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
padding: 0.6rem 0.75rem;
|
|
|
|
|
|
font-size: 0.8rem;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
margin-bottom: 1rem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.scenario strong {
|
|
|
|
|
|
color: var(--vp-c-text-1);
|
|
|
|
|
|
}
|
2026-02-14 12:14:07 +08:00
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.main-area {
|
|
|
|
|
|
display: grid;
|
|
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
|
|
gap: 1rem;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
margin-bottom: 1rem;
|
2026-02-14 12:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
@media (max-width: 768px) {
|
|
|
|
|
|
.main-area { grid-template-columns: 1fr; }
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.left-panel {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
gap: 0.75rem;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.controls {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
gap: 0.4rem;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.control-row {
|
2026-01-15 20:10:19 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
|
background: var(--vp-c-bg);
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
padding: 0.4rem 0.6rem;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.control-row label {
|
|
|
|
|
|
font-size: 0.8rem;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
font-weight: 500;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
min-width: 55px;
|
|
|
|
|
|
color: var(--vp-c-text-1);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
font-family: var(--vp-font-family-mono);
|
2026-01-18 12:21:49 +08:00
|
|
|
|
}
|
2026-01-15 20:10:19 +08:00
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.control-row input[type='range'] {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
height: 4px;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
accent-color: var(--vp-c-brand);
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.control-row .val {
|
|
|
|
|
|
font-family: var(--vp-font-family-mono);
|
|
|
|
|
|
font-size: 0.75rem;
|
|
|
|
|
|
color: var(--vp-c-brand);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
min-width: 40px;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
text-align: right;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.box-sizing-toggle {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.toggle-label {
|
|
|
|
|
|
font-size: 0.8rem;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
font-family: var(--vp-font-family-mono);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.toggle-btn {
|
|
|
|
|
|
padding: 0.3rem 0.6rem;
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
background: var(--vp-c-bg);
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
font-size: 0.7rem;
|
|
|
|
|
|
font-family: var(--vp-font-family-mono);
|
|
|
|
|
|
transition: all 0.2s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.toggle-btn:hover { background: var(--vp-c-bg-soft); }
|
|
|
|
|
|
.toggle-btn.active {
|
|
|
|
|
|
border-color: var(--vp-c-brand);
|
|
|
|
|
|
color: var(--vp-c-brand);
|
|
|
|
|
|
background: var(--vp-c-brand-soft);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.visual {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
background: var(--vp-c-bg);
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
padding: 1rem;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
display: flex;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
min-height: 140px;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.layer {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
transition: all 0.2s;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.layer-label {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 2px;
|
|
|
|
|
|
left: 4px;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
font-size: 9px;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
|
font-family: var(--vp-font-family-mono);
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.margin {
|
2026-02-14 22:48:56 +08:00
|
|
|
|
background: rgba(251, 191, 36, 0.1);
|
|
|
|
|
|
border: 1px dashed rgba(251, 191, 36, 0.5);
|
2026-01-18 12:21:49 +08:00
|
|
|
|
}
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.margin .layer-label { color: #d97706; }
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
|
|
|
|
|
.border {
|
2026-02-14 22:48:56 +08:00
|
|
|
|
background: rgba(14, 165, 233, 0.1);
|
2026-01-16 19:10:21 +08:00
|
|
|
|
border-style: solid;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
border-color: var(--vp-c-brand);
|
2026-01-18 12:21:49 +08:00
|
|
|
|
}
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.border .layer-label { color: var(--vp-c-brand); }
|
2026-01-15 20:10:19 +08:00
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.padding {
|
2026-02-14 22:48:56 +08:00
|
|
|
|
background: rgba(34, 197, 94, 0.1);
|
|
|
|
|
|
border: 1px dashed rgba(34, 197, 94, 0.5);
|
2026-01-18 12:21:49 +08:00
|
|
|
|
}
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.padding .layer-label { color: #16a34a; }
|
2026-01-15 20:10:19 +08:00
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.content {
|
|
|
|
|
|
background: var(--vp-c-brand);
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
border-radius: 4px;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
font-size: 0.7rem;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
height: 50px;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
display: flex;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
flex-direction: column;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
text-align: center;
|
|
|
|
|
|
line-height: 1.3;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.right-panel {
|
2026-01-15 20:10:19 +08:00
|
|
|
|
display: flex;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
flex-direction: column;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
gap: 0.75rem;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.result-card {
|
2026-02-14 20:23:34 +08:00
|
|
|
|
background: var(--vp-c-bg);
|
|
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
padding: 0.75rem;
|
2026-01-18 12:21:49 +08:00
|
|
|
|
}
|
2026-01-16 19:10:21 +08:00
|
|
|
|
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.result-header {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
display: flex;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
align-items: center;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
margin-bottom: 0.25rem;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.result-title {
|
|
|
|
|
|
font-size: 0.8rem;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.result-value {
|
2026-02-14 22:48:56 +08:00
|
|
|
|
font-size: 1.25rem;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
font-weight: 700;
|
|
|
|
|
|
color: var(--vp-c-brand);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
font-family: var(--vp-font-family-mono);
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.formula {
|
2026-01-16 19:10:21 +08:00
|
|
|
|
font-family: var(--vp-font-family-mono);
|
2026-02-14 20:23:34 +08:00
|
|
|
|
font-size: 0.75rem;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
background: var(--vp-c-bg-soft);
|
|
|
|
|
|
padding: 0.4rem 0.6rem;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-hint {
|
|
|
|
|
|
margin-top: 0.5rem;
|
|
|
|
|
|
font-size: 0.75rem;
|
|
|
|
|
|
color: var(--vp-c-success);
|
|
|
|
|
|
padding: 0.4rem 0.6rem;
|
|
|
|
|
|
background: var(--vp-c-success-soft);
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.result-hint.warning {
|
|
|
|
|
|
color: var(--vp-c-warning);
|
|
|
|
|
|
background: var(--vp-c-warning-soft);
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.code-block {
|
2026-02-14 20:23:34 +08:00
|
|
|
|
background: var(--vp-c-bg);
|
2026-01-16 19:10:21 +08:00
|
|
|
|
border: 1px solid var(--vp-c-divider);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
padding: 0.75rem;
|
2026-02-14 20:23:34 +08:00
|
|
|
|
flex: 1;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.code-title {
|
2026-02-14 20:23:34 +08:00
|
|
|
|
font-size: 0.75rem;
|
|
|
|
|
|
font-weight: 600;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
color: var(--vp-c-text-2);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
margin-bottom: 0.5rem;
|
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
|
letter-spacing: 0.5px;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-16 19:10:21 +08:00
|
|
|
|
.code-content {
|
2026-02-14 22:48:56 +08:00
|
|
|
|
background: #1a1a2e;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
color: #e5e7eb;
|
2026-02-14 22:48:56 +08:00
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
padding: 0.75rem;
|
2026-01-16 19:10:21 +08:00
|
|
|
|
font-family: var(--vp-font-family-mono);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
font-size: 0.75rem;
|
|
|
|
|
|
line-height: 1.6;
|
2026-01-15 20:10:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.line { white-space: pre; }
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.hl {
|
|
|
|
|
|
color: var(--vp-c-brand);
|
|
|
|
|
|
}
|
2026-02-14 12:14:07 +08:00
|
|
|
|
|
|
|
|
|
|
.info-box {
|
|
|
|
|
|
background: var(--vp-c-bg-alt);
|
2026-02-14 22:48:56 +08:00
|
|
|
|
padding: 0.75rem 1rem;
|
|
|
|
|
|
border-radius: 8px;
|
2026-02-14 12:14:07 +08:00
|
|
|
|
font-size: 0.85rem;
|
|
|
|
|
|
color: var(--vp-c-text-2);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-14 20:23:34 +08:00
|
|
|
|
.info-box strong { color: var(--vp-c-text-1); }
|
2026-02-14 22:48:56 +08:00
|
|
|
|
.info-box code {
|
|
|
|
|
|
background: var(--vp-c-bg-soft);
|
|
|
|
|
|
padding: 0.1rem 0.3rem;
|
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
|
font-size: 0.8rem;
|
|
|
|
|
|
}
|
2026-01-15 20:10:19 +08:00
|
|
|
|
</style>
|