【问题标题】:How to use style in SCSS and HTML in ionic4?如何在ionic4中使用SCSS和HTML中的样式?
【发布时间】:2020-02-08 15:30:30
【问题描述】:

我正在将源代码从 ionic3 迁移到 ionic4。
由于此错误,html 中 text-center 的用法已更改。

[DEPRECATED][CSS] Ionic CSS attributes are deprecated.
Replace:
'<p text-center>'

With:
'<p class="ion-text-center">'


如何在ionic4中编写以下代码?
请帮帮我。

为 ionic3 写作

html

<p class="txt_login" text-center (click)="Login()">LOGIN</p>

scss

.txt_login{
    color:white;
    font-size: 10.5rem;
  }


【问题讨论】:

    标签: html css angular ionic-framework ionic4


    【解决方案1】:

    在类属性中使用两个类名

    <p class="txt_login ion-text-center" (click)="Login()">LOGIN</p>
    

    【讨论】:

    • 我试过了,还是不行。
      字体显示很大。
    • @Hyonta,你的根元素的字体大小是多少,因为 10.5 rem 非常大。也许你应该使用更小的值,比如 1.5rem
    猜你喜欢
    • 1970-01-01
    • 2021-02-19
    • 2019-01-30
    • 2022-08-05
    • 1970-01-01
    • 1970-01-01
    • 2021-07-27
    • 2020-02-13
    • 2014-08-02
    相关资源
    最近更新 更多