我如何修改< p>的字体尺寸在离子6中的离子卡内部标记6
像这个问题一样,我正在使用VUE 3和Ionic 6开发一个项目。
我想更改< p>
在< ion-card-content>中的字体大小。
。
我的页面:
<ion-card>
<ion-card-header>
<ion-card-title>Title</ion-card-title>
<ion-card-subtitle>Sub Title</ion-card-subtitle>
</ion-card-header>
<ion-card-content v-html="data.content">
</ion-card-content>
</ion-card>
data.content
是从服务器请求的。它的结构就像以下内容:
<p>This is my page!</p>
<p>Welcome to my home.</p>
我看到它在Chrome Devtools中进行了样式。
.card-content-md p {
margin-left: 0;
margin-right: 0;
margin-top: 0;
margin-bottom: 2px;
font-size: 14px;
font-weight: normal;
line-height: 1.5;
}
但是我不知道如何修改它,我想修改字体大小:16px。
谁能帮忙?谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
解决此问题的唯一方法是删除带有与离子卡符号相同特征的DIV标签的离子卡符号标签。这是一种更好的解决方案,因为现在您可以自定义您的离子卡包含。
我尝试相同的方式,对我有用。请记住,离子文档中的离子卡 - 包含没有CSS信息:
The only way to fix this problem is to remove the ion-card-content tag and replace with a div tag with the same characteristics as the ion-card-content. This is a way better solution because now you can customize your ion-card-content.
I try the same way and it works for me. Remember that ion-card-content has no CSS information in the ionic documentation: https://ionicframework.com/docs/api/card-content#css-custom-properties
在.css中,您想更改离子卡标签的字体大小或在全球CSS中以各处更改它。
In the .css where you want to change the Font-Size of a ion-card-title or in the global css to change it everywhere.
以下对我有用:
或者,如果您想针对特定类别:
当然,这需要进行全局。SCSS。
我希望这对某人有用。
The below worked for me:
or if you want to target an specific class:
Of course, this needs to go on your global.scss.
I hope this can be useful to someone.
检查: https://ionicframe.com/docs/docs/docs/theming/theming/css-variobles
尝试 JavaScript:
Check: https://ionicframework.com/docs/theming/css-variables
Try javascript: