常用简写方式
| 简写 | 对应属性 |
|---|
box-border | border-box |
box-content | content-box |
| 简写 | 对应属性 |
|---|
w-auto | width: auto |
w-px | width: 1px |
w-full | width: 100% |
w-screen | width: 100vw |
w-min | width: min-content |
w-max | width: max-content |
w-[50%] | width: 50% |
| 简写 | 对应属性 |
|---|
width | w- |
min-width | min-w- |
max-width | max-w- |
height | h- |
min-height | min-h- |
max-height | max-h- |
示例
<template>
<div class="bg-black h-50px w-50px border-10 p-10px m-10 box-border"></div>
<div class="bg-black h-50px w-50px border-10 p-10px m-10 box-content"></div>
<div class="flex justify-around align-middle flex-wrap bg-black">
<div
v-for="(value, index) in cfg"
:key="index"
class="flex align-middle justify-between w-screen mt-10px"
>
<div v-for="(item, subIndex) in value" :key="subIndex">
<div :class="[baseClass, item]">{{ item }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const baseClass = ref(
'leading-150px bg-red-500 m-auto text-white whitespace-nowrap',
);
const cfg = ref({
widthCfg: ['w-150px h-150px', 'w-auto h-auto', 'w-px h-px', 'w-full h-full'],
minWidthCfg: [
'min-w-150px min-h-150px',
'min-w-auto min-h-auto',
'min-w-px min-h-px',
'min-w-full min-h-full',
],
});
</script>
还没有留言,来发表第一条吧~