Skip to content

尺寸

🌐 Sizing

默认情况下,所有图标的尺寸为 24px × 24px。尺寸可以通过绑定 size 输入和 CSS 来调整。

🌐 By default, the size of all icons is 24px by 24px. The size is adjustable either by binding the size input and CSS.

使用 size 输入调整图标大小

🌐 Adjusting the icon size using the size input

import { Component, ViewEncapsulation } from "@angular/core";
import { LucideLandmark } from "@lucide/angular";

@Component({
  selector: 'app',
  imports: [LucideLandmark],
  template: `<svg lucideLandmark [size]="64" />`,
  styleUrls: ['./app.component.css'],
  encapsulation: ViewEncapsulation.None,
})
export class App {
}

通过 CSS 调整图标大小

🌐 Adjusting the icon size via CSS

CSS 属性 widthheight 可用于调整图标大小。

🌐 The CSS properties width and height can be used to adjust the icon size.

.my-beer-icon {
  /* Change this! */
  width: 64px;
  height: 64px;
}

根据字体大小动态更改图标大小

🌐 Dynamically change the icon size based on the font size

可以根据字体大小调整图标的大小。这可以使用 em 单位来实现。有关 em 单位的更多信息,请参阅这篇 MDN 文章

🌐 It is possible to resize icons based on font size. This can be achieved using the em unit. See this MDN article for more information on the em unit.

.my-icon {
  /* Icon size will relative to font-size of .text-wrapper */
  width: 1em;
  height: 1em;
}

.text-wrapper {
  /* Change this! */
  font-size: 96px;

  /* layout stuff */
  display: flex;
  gap: 0.25em;
  align-items: center;
}

使用 Tailwind 调整大小

🌐 Resizing with Tailwind

size-* 工具可以用来调整图标的大小。有关 size-* 工具的更多信息,请参阅 Tailwind 文档

app.html
html
<div>
  <svg lucidePartyPopper class="size-24"></svg>
</div>