html - 使用标签更改颜色文本
问题描述
Label
使用Nativescript时如何更改菜单栏上的文本颜色。
我的代码:
<StackLayout row="1" orientation="horizontal" backgroundColor="#eae8e8" class="foot">
<Label width="25%" textAlignment="left" [nsRouterLink]="['/photos']">
<FormattedString>
<Span text="Photos"></Span>
</FormattedString>
</Label>
<Label width="25%" textAlignment="left" [nsRouterLink]="['/albums']">
<FormattedString>
<Span text="Albums"></Span>
</FormattedString>
</Label>
</StackLayout>
解决方案
您可以color
在 CSS 和直接 HTML 中使用属性来指定元素的颜色。例如:
zontal" backgroundColor="#eae8e8" class="foot">
<Label width="25%" textAlignment="left" [nsRouterLink]="['/photos']">
<FormattedString>
<Span color="blue" text="Photos"></Span>
</FormattedString>
</Label>
<Label width="25%" textAlignment="left" [nsRouterLink]="['/albums']">
<FormattedString>
<Span text="Albums"></Span>
</FormattedString>
</Label>
</StackLayout>
这是游乐场演示:https ://play.nativescript.org/?template=play-ng&id=gMhuwo&v=2
推荐阅读
- pandas - 矩阵维数对齐
- svg - 转换后的 SVG 元素的触摸事件是错误的
- reactjs - 如何在 React 中使用 PaperJs?
- javascript - 重构的 Express 中间件给出了“无法设置未定义的属性”
- kubernetes - 如何知道服务何时创建?
- excel - 相加后单元格值变为照片
- angular - 从 Angular 6+ 客户端应用程序调用 GET ASP .NET core 2.1 Web API 不会返回任何数据
- c - while循环终止后的代码不运行
- python - Django 中 /admin/todo/todo/ 的 OperationalError
- javascript - 通过 qwest 的 REST Firebase 请求