Angular PrimeNG虚线风格的分割线文本
Angular PrimeNG是一个开源框架,拥有丰富的原生Angular UI组件,可用于出色的风格设计,该框架可用于制作响应式网站,非常容易。在这篇文章中,我们将了解如何在Angular PrimeNG中使用**虚线风格的分割线文本。我们还将学习属性和样式,以及在代码中使用的语法。
分隔符组件是用来做一个使用分隔符来划分内容的组件。
Angular PrimeNG Divider Text with Dashed Style 属性:
- align: 它用于设置内容的对齐方式。它是字符串数据类型,默认值为空。
- type。它是边界风格类型。它是字符串数据类型,默认值是纯色。
语法:
<p-divider align="..."
type="dashed">
<b>...</b>
</p-divider>
创建Angular应用程序和模块安装。
第1步:使用以下命令创建一个Angular应用程序。
ng new appname
第2步:创建你的项目文件夹即appname后,使用以下命令移动到它。
cd appname
第3步:在你给定的目录中安装PrimeNG。
npm install primeng --save
npm install primeicons --save
项目结构:它将看起来像如下。
运行以下命令以查看输出。
ng serve --open
示例1:下面的示例代码说明了Angular PrimeNG Divider Text with Dashed Style的使用,它具有左对齐和中心对齐的功能。
<h2 style="color: green">GeeksforGeeks</h2>
<h5>PrimeNG Divider Text with Dashed Style</h5>
<div>
<p>
Angular PrimeNG is a framework used
with angular to create components with
great styling and this framework is very
easy to use and is used to make
responsive websites.
</p>
<p-divider align="center" type="dashed">
<b>Divider</b>
</p-divider>
<p>
Angular PrimeNG is a framework used with
angular to create components with
great styling and this framework is very
easy to use and is used to make
responsive websites.
</p>
<p-divider align="left" type="dashed">
<b>Divider</b>
</p-divider>
<p>
Angular PrimeNG is a framework used with
angular to create components with
great styling and this framework is very
easy to use and is used to make
responsive websites.
</p>
</div>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from
'@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { DividerModule } from 'primeng/divider';
@NgModule({
imports: [BrowserModule,
BrowserAnimationsModule,
DividerModule
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
输出:
示例2:下面是另一个示例代码,说明了Angular PrimeNG Divider Text with Dashed Style的使用,具有右对齐和居中对齐。
<h2 style="color: green">GeeksforGeeks</h2>
<h5>PrimeNG Divider Text with Dashed Style</h5>
<div>
<p>
Angular PrimeNG is a framework used
with angular to create components with
great styling and this framework is very
easy to use and is used to make
responsive websites.
</p>
<p-divider align="center" type="dashed">
<b>Divider</b>
</p-divider>
<p>
Angular PrimeNG is a framework used with
angular to create components with
great styling and this framework is very
easy to use and is used to make
responsive websites.
</p>
<p-divider align="right" type="dashed">
<b>Divider</b>
</p-divider>
<p>
Angular PrimeNG is a framework used with
angular to create components with
great styling and this framework is very
easy to use and is used to make
responsive websites.
</p>
</div>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from
'@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { DividerModule } from 'primeng/divider';
@NgModule({
imports: [BrowserModule,
BrowserAnimationsModule,
DividerModule
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
输出: