首页 > 编程语言 >微信小程序 文字居中

微信小程序 文字居中

时间:2023-03-14 12:32:20浏览次数:36  
标签:居中 文字 center flex 微信 height 666 200rpx


1 有宽高 line-height

<view class='container'>
666
</view>
.container{
border: 2rpx black solid;
width: 400rpx;
height: 200rpx;
text-align: center; /* 左右居中 */
line-height: 200rpx; /* 设置行高 使文字上下居中 */
}

2 使用flex布局

<view class='container'>
<text>666</text>
</view>
.container{
border: 2rpx solid red;
width: 500rpx;
height: 200rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}


标签:居中,文字,center,flex,微信,height,666,200rpx
From: https://blog.51cto.com/u_16006123/6120328

相关文章

  • 微信小程序支付
    https://blog.csdn.net/qq_26383975/article/details/119997928(微信小程序支付大体流程)1.打开某小程序,点击直接下单。2.wx.login获取用户临时登录凭证code,发送到后端服务......
  • 前端知识点1-text align是写在父级居中还是子级
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"/><metahttp-equiv="X-UA-Compatible"content="IE=edge"/><metaname="viewport"content=......
  • 页面元素水平垂直居中
    在页面布局中,元素水平垂直居中的方法有很多,这里就列举3个简单,用的比较多的方法吧。情况一、已知元素的宽高1<style>2.center{3width:......
  • pc端微信扫码登录,内嵌版
    官方文档https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html贴代码【index.html】引入wx文件<scriptsrc="https://res.wx.......
  • 微信小程序弹出框 页面依然可以滑动的解决
    在弹出框的最外层view中加入catchtouchmove=”preventTouchMove”js中写一个空白函数preventTouchMove:function(e){}, ......
  • openpyxl 文字竖排
    openpyxl文字竖排使用openpyxl如何设置文本竖排显示,而不是文本旋转角度显示?在对齐类属性中有一个textRotation参数,设置textRotation=255就可以设置文本竖排显示,当设置......
  • 微信小程序:配置合法域名
    1、问题背景写微信小程序,当调用request访问外部网站时,经常出现没有配置合法域名而无法调用的情况。遇到这种情况要去微信开发平台配置服务器域名网站必须备案必须是https2、......
  • 收到微信视频邀请时唤醒屏幕-AHK
    loop{ifWinExist("ahk_classVoipTrayWnd"){send,{space}send,{enter}loop{If!WinExist("ahk_classVoipTrayWnd"){......
  • 使用免费API开发微信小程序
    最新在看微信小程序文档,做了一个简单的小程序——每日开心短视频用到的免费api地址:https://api.aa1.cn 预览效果: 可以扫描小程序二维码体验:(忽略头像[旺柴])  ......
  • 微信小程序中录音实现
    今日继续在第二大学远程实习中进行学习,分享学习中的一个小功能,录音功能。常用:duration:10000,//指定录音的时长,单位mssampleRate:16000,//采样率numberOfChannels:......