英文:
Configure ion-title element to support multiple lines
问题
我想要ion-title元素能够显示多行,我尝试了一切但没有成功。white-space属性似乎不起作用。
应该如何正确实现这一点?
这里是我正在尝试的示例:https://stackblitz.com/edit/angular-uyq4qa?file=src%2Fapp%2Fexample.component.html
<ion-header translucent="true" class="ion-no-border">
<ion-toolbar color="">
<ion-buttons slot="primary" class="ion-button">
<ion-button>
<ion-icon slot="icon-only" name="contrast"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content fullscreen="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">
长文本,包括多行,Lorem ipsum dolor sit amet, consectetur
adipiscing elit. In ac felis velit. Nulla accumsan velit ipsum, tempus
euismod orci porta a. Ut lacus augue, sodales at auctor sed, vulputate
et tellus.
</ion-title>
</ion-toolbar>
</ion-header>
<div class="ion-padding">滚动列表以查看标题折叠。</div>
...
</ion-content>
英文:
I want the ion-title element to be able to display multiple lines, I've tried everything without any success. The white-space property doesn't seem to work
What would be the correct way to do this?
Here an example of what I'm trying https://stackblitz.com/edit/angular-uyq4qa?file=src%2Fapp%2Fexample.component.html
<ion-header translucent="true" class="ion-no-border">
<ion-toolbar color="">
<ion-buttons slot="primary" class="ion-button">
<ion-button>
<ion-icon slot="icon-only" name="contrast"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content fullscreen="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">
Long text with multiple lines, Lorem ipsum dolor sit amet, consectetur
adipiscing elit. In ac felis velit. Nulla accumsan velit ipsum, tempus
euismod orci porta a. Ut lacus augue, sodales at auctor sed, vulputate
et tellus.
</ion-title>
</ion-toolbar>
</ion-header>
<div class="ion-padding">Scroll the list to see the title collapse.</div>
...
</ion-content>
答案1
得分: 1
ion-title
不应该用于长文本。您应该使用p
或span
标签,并使用CSS进行样式设置。
或者使用<ion-label>
或<ion-text>
。
英文:
ion-title
is not supposed to be used with long text. You should use the p or span tags and use css to style.
or use <ion-label>
or <ion-text>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论