RE: RE: Nuxt开发指南
You are viewing a single comment's thread from:

RE: Nuxt开发指南

Words
72
Reading
1 min
Listen
Play
7M

原子化css |
互动样式 |
样式参考 |
Tailwind CSS |
颜色样式 |
加深理解inline、block、inline-block

可以认为Unocss兼具了TailwindCSS 和 Windicss的优点,同时还具有自身的定制性和灵活性。按需引入,体积小,速度快。

1. 使classUnocssclass
<div class="bg-blue-200"> Index Page</div>
<div bg-pink-200 text-cyan></div>

2. style
<div class="text"> Index Page</div>
<style>
.text {
  @apply text-xs text-red-300 hover:bg-zinc-900;
}
.btn {
  @apply text-red-700  border border-red-500 !rounded-full;  // rounded-full !important 
}
</style>

3. 
.test {
  color: white;
  font-size: 2rem;
  @apply bg-blue;
}

4. (Attributify Mode)
<button 
  bg="blue-400 hover:blue-500 dark:blue-500 dark:hover:blue-600"
  text="sm white"
  font="mono light"
  p="y-2 x-4"
  border="2 rounded blue-200"
>
  Button
</button>

5. `uno.config.ts` rules  shortcuts
rules: [
  ['custom-rule', { color: 'red' }],
  ['main2', { margin: '0.25rem', padding: '2rem', color: 'red', 
  'background-color': 'blue'}],
],
shortcuts: {
  // shortcuts to multiple utilities
  'custom-shortcut': 'text-lg text-orange hover:text-teal',
  'btn': 'py-2 px-4 font-semibold rounded-lg shadow-md',
  'btn-green': 'text-white bg-green-500 hover:bg-green-700',
  // single utility alias
  'red': 'text-red-100'
}
@lemooljiang: 原子化css | 互动样式 | Ecency