当前位置:网站首页>The picture display on the left of the two column layout is determined by the content height on the right
The picture display on the left of the two column layout is determined by the content height on the right
2022-06-28 23:06:00 【Small white eye】
demand :
Card content is a two column layout , Text... Left ; Now it is required that the display part of the picture on the left should be determined by the height of the content on the right , The effect is as shown in the picture :

html Layout :
<div class="detail-card-content">
<!-- On the left -->
<div class="left" >
<div :style="{height:`${rightHeight}px`}" class="left-box" >
<img src="https://4gimg.map.qq.com/test/c955266c3cf8f974e7acde20e2c6a011.png"
>
</div>
</div>
<!-- Right content -->
<div class="right">
<div class="right-box">
<div class="111">
<span
v-for="item in themeTags"
v-show="themeTagsStyleConfig(item)"
:style="getTagStyle(item,'rowtag')"
class="detail-card_tag-rich"
>{
{
item.tag_name
}}</span>
</div>
<div class="222">
<div
v-show="themeTipsStyleConfig(item).icon"
class="detail-card-tip-icon"
>
<img
:src="themeTipsStyleConfig(item).icon"
>
</div>
</div>
<!-- <div>333</div> -->
</div>
</div>
</div>About rightHeight The monitor is as follows :
watch: {
data: {
handler(value) {
},
},
poiData: {
handler(value) {
this.$nextTick(() => {
console.error(document.querySelector('.right-box') ? document.querySelector('.right-box').offsetHeight : 80);
const Height = document.querySelector('.right-box') ? document.querySelector('.right-box').offsetHeight : 80;
this.rightHeight = Height;
});
},
},
},css Realization :flex Layout + overflow-y: hidden;
// Outer layer
.detail-card-content {
display: flex; //
box-sizing: border-box;
margin: 0 auto;
margin-bottom: 0.14rem;
padding: 0.2rem 0;
width: calc(100vw - 0.32rem);
border-radius: 0.4rem;
background-color: #FFF;
}// On the left
.left {
width: 1.6rem;
// background: gold;
.left-box {
display: flex;
overflow: hidden;
flex-direction: column-reverse;
min-height: 70px;
border-radius: 0.34rem;
}
}// Right content
.right {
flex: 1;
.right-box {
display: inline-block;
}
}Be careful :
1. Implementation of two column layout : Parent box flex Layout , Left box width , On the right flex:1
2. flex The child elements of the layout will adapt to the height of the parent element , So to get the height of the box on the right , Need to be in .right below Wrap the contents in a box , The content on the right will automatically open .right-box ; To get the height on the right .
边栏推荐
- Panxiaoming, senior vice president of IC nansha|amd and President of Greater China: process, architecture and platform optimization break through the computing boundary
- How to analyze the trend chart of London gold market with the moving average
- Is it safe to open a stock account by mobile phone?
- Code example of hiredis
- CS5463代码模块解析(包含下载链接)
- 第二章 经典同步练习作业
- WEB API学习笔记1
- 云计算的迷路者
- Tanghongbin, Yaya live CTO: to truly localize, the product should not have the attribute of "origin"
- Zadig + sonarqube, ensuring the safety of the development process
猜你喜欢

Multiomics single cell data integration and regulatory reasoning based on graph linked embedding

月薪6万,互联网“降本增效”后,这类人开始被疯抢

生产环境sonarqube安装

如何使用伦敦金画出支撑阻力线

在线SQL转HTMLTable工具

Web API learning notes 1

LeCun预言AGI:大模型和强化学习都是斜道!我的世界模型才是新路

YuMinHong set up two funds funded by his hometown

第四章 存储器管理练习

Fanuc robot_ Introduction to Karel programming (2)_ Usage of general IO signal
随机推荐
CPU、GPU、TPU、NPU区别
Complex nested object pool (4) -- manage the object pool of multi class instances and multi-stage instances
Go language - reflect
生产环境sonarqube安装
【Word 教程系列第 1 篇】如何去除 Word 表格中的箭头
Cs5463 code module analysis (including download link)
复杂嵌套的对象池(4)——管理多类实例和多阶段实例的对象池
CS5463代码模块解析(包含下载链接)
Is it safe to open a stock account by mobile phone?
小样本利器2.文本对抗+半监督 FGSM & VAT & FGM代码实现
网上办理股票开户安全性高吗?
浅析搭建校园在线教学视频汇聚平台的必要性及解决方案
With a monthly salary of 60000 yuan, such people began to be robbed after the Internet "reduced costs and increased efficiency"
TDD案例实战
CIN at QT (the clearest tutorial in the whole network)
他原来是这么刷题的!
在长投学堂开通证券账户是安全可靠的吗?
2022 PMP project management examination agile knowledge points (4)
一文搞懂shell脚本
[flutter issues Series title 71] Mutual Conversion between uint8list and Image in flutter