微信小程序自学笔记 您所在的位置:网站首页 微信小程序字体大小样式 微信小程序自学笔记

微信小程序自学笔记

2023-07-23 17:37| 来源: 网络整理| 查看: 265

微信小程序自学笔记-----文本和字体样式设置

用于自己自学微信小程序知识点总结,新手小白一枚,请大佬勿喷

知识要点 · 各种字体样式属性命名及含义 · 利用style和class设置字体样式的方法 · 在index.wxss和app.wxss定义样式的方法 · 各种文本样式属性命名及其含义 · 设置文本样式的方法 案例描述 设计一个小程序,分别利用style和class属性设置字体样式,在index.wxss中定义样式类。所有的文字都包含在一个边框内,边框内上方有标题。文字,边框和标题样式利用class属性来设置,在app.wxss中定义样式类。利用class属性设置文本样式包括:文本颜色、字符缩进、对齐文本、装饰文本、对文本进行缩进等等。 实现效果 在这里插入图片描述

index.wxml文件代码 app.wxml.

字体样式设置 文本的属性可以定义文本的外观。通过设置文本的属性,您可以改变文本的颜色、 字符间距,对齐文本,装饰文本,对文本进行缩进等等。 ============================== I have a good friend, and her name is Li Hua. We have become friends for about two years. She is very kind. When I step into the classroom for the first time, she helps me to get familiar with the strange environment. The most important thing is that we share the same interest, so we have a lot in common. I cherish our friendship so much ============================== 利用Style设置字体样式 字体:sans-serif,30像素 ============================== 利用Class设置字体样式: 字体:Curseive。

index.wss文件代码 index.wxss.

/**index.wxss**/ .fontStyle{ font-family: cursive; font-size: 25px; font-style: italic; font-weight: bold; } .textStyle01{ color: blue; letter-spacing: 10px; text-align: left; text-indent: 50px; text-decoration: underline; text-decoration-color: chartreuse; line-height: 30px; white-space: normal; } .textStyle00{ text-align: justify; word-spacing: 20px; text-transform: uppercase; white-space: pre-wrap; }

app.wss文件代码 app.wxss.

/**app.wxss**/ .box{ border: 1px solid silver; margin: 20rpx; padding: 20rpx; } .title{ font-size: 25px; text-align: center; margin-bottom: 15px; color: red; }

· view组件支持使用 style、class属性来设置组件的样式,静态的样式一般写到class中,动态的样式一般写到style中,这样能够提高渲染的速度 · class引用的样式类可以在index.wxss和app.wxss中定义。 在app.wxss中定义的样式属于全局样式类,可以在项目的任意文件中使用 在index.wxss中定义的样式类一般只在index.wxml中使用

各属性名和含义

在这里插入图片描述 在这里插入图片描述打卡微信小程序学习第一天!!!



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有