当前位置:网站首页>[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
2022-07-01 18:59:00 【Huawei Developer Forum】
【 Phenomenon description 】
When text When the content of components is more than one line , The adjacent div The style displays an exception , Will change from a normal circle to an ellipse .
The code is as follows :
<template> <div class="container"> <div style="align-items: center;"> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> </div> </div></template><style> .container { flex-direction: column; justify-content: center; height: 100%; } text { font-size: 24px; } .typscolor { border-radius: 50%; width: 30px; height: 30px; background-color: red; margin-right: 8px; }</style><script> module.exports = { data: { text:'text When there is too much text, the circle on the left will be stretched ' }, onInit() { }, } </script>
As shown in the figure
abnormal
normal
【 Problem analysis 】
When text When there are too many components ,flex When the width exceeds the layout, it will be automatically compressed , Which leads to div The label is stretched
【 resolvent 】
You can give div Label settings flex-shrink: 0 attribute , To solve the problem
The sample code is as follows :
<template> <div class="container"> <div style="align-items: center;"> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> <div class="typscolor" style="background-color: blue; opacity: 0.26; margin-left: 16px;"></div> <text>{{text}}</text> </div> </div></template><style> .container { flex-direction: column; justify-content: center; height: 100%; } text { font-size: 24px; } .typscolor { border-radius: 50%; width: 30px; height: 30px; background-color: red; margin-right: 8px; flex-shrink: 0; /* Add this attribute to solve the stretching problem */ }</style><script> module.exports = { data: { text:'text When there is too much text, the circle on the left will be stretched ' }, onInit() { }, } </script>
As shown in the figure :
For more details , Please see the :
Huawei official website :
https://developer.huawei.com/consumer/cn/forum/topic/0203908673278080243?fid=23?ha_source=zzh
边栏推荐
- Lumiprobe non fluorescent alkyne EU (5-ethynyluridine)
- Weekly recommended short videos: be alert to the confusion between "phenomena" and "problems"
- 6款红黄黑榜摄像头评测:谁最安全?谁画质好?从此让你不再踩雷
- Lumiprobe lumizol RNA extraction reagent solution
- Docker deploy mysql8.0
- Example explanation: move graph explorer to jupyterlab
- R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器、table函数计算混淆矩阵
- 搭建一個通用監控告警平臺,架構上需要有哪些設計
- Regular expression
- Write it down once Net travel management background CPU Explosion Analysis
猜你喜欢
Clean up system cache and free memory under Linux
实现一个Prometheus exporter
3、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》在本地铸造 NFT
6款红黄黑榜摄像头评测:谁最安全?谁画质好?从此让你不再踩雷
Implement a Prometheus exporter
Example explanation: move graph explorer to jupyterlab
斯坦福、Salesforce|MaskViT:蒙面视觉预训练用于视频预测
精耕渠道共谋发展 福昕携手伟仕佳杰开展新产品培训大会
Lumiprobe lumizol RNA extraction reagent solution
Leetcode203 移除链表元素
随机推荐
The R language cartools package divides the data, the scale function scales the data, the KNN function of the class package constructs the k-nearest neighbor classifier, and the table function calcula
2020,最新手机号码手机验证正则表达式,持续更新
Salesmartly has some tricks for Facebook chat!
精耕渠道共谋发展 福昕携手伟仕佳杰开展新产品培训大会
Li Kou daily question - Day 32 -1232 Dotted line
Lumiprobe非荧光炔烃丨EU(5-乙炔基尿苷)
Three. JS learning - basic operation of camera (learn from)
Docker deploy mysql8.0
Weekly recommended short videos: be alert to the confusion between "phenomena" and "problems"
数据仓库(四)之ETL开发
记一次 .NET 差旅管理后台 CPU 爆高分析
6款红黄黑榜摄像头评测:谁最安全?谁画质好?从此让你不再踩雷
R语言使用epiDisplay包的dotplot函数通过点图的形式可视化不同区间数据点的频率、使用pch参数自定义指定点图数据点的形状
Why do independent website sellers start to do social media marketing? The original customer conversion rate can be improved so much!
Leetcode-160 intersecting linked list
R language uses the DOTPLOT function of epidisplay package to visualize the frequency of data points in different intervals in the form of point graph, and uses PCH parameters to customize the shape o
Three.js学习-相机Camera的基本操作(了解向)
Halcon图片标定,使得后续图片处理过后变成与模板图片一样
R语言caTools包进行数据划分、scale函数进行数据缩放、class包的knn函数构建K近邻分类器、table函数计算混淆矩阵
How to operate technology related we media well?