gpt4 book ai didi

html - 文字在移动版网页中的位置

转载 作者:行者123 更新时间:2023-11-28 19:30:50 32 4
gpt4 key购买 nike

我有一个 slider ,里面有文本,我需要让这个文本响应。我的意思是在计算机版本中它看起来像我想要的那样,但在移动版本中它会移动并且我看不到我的图标在彼此下面。

CSS:

.sliderr__item .slid{
display: flex;
flex-direction: column;
width: 100%;
margin-left: 50px;
margin-top: 50px;
text-align: left;
align-items: flex-start;
justify-content: flex-start;
}
/*END*/

.sliderr {
background-color: #fff;
position: relative;
overflow: hidden;
width: 100%;
}
.sliderr__wrapper {
display: flex;
transition: transform 0.6s ease;
/* ADDED: */
margin-bottom: 10px;
}
.sliderr__item {
flex: 0 0 50%;
}

.sliderr .date {
display: inline-block;
margin-left: 1em;
}

/* Added: */
.sliderr__controls {
display: flex;
justify-content: center;
flex-flow: row;
}
.sliderr__control {
/* Added: */
border-radius: 50%;
/* Updated: */
position: relative;
top: 0;
width: 25px;
/* The Same: */
display: flex;
align-items: center;
justify-content: center;
color: #fff;
text-align: center;
height: 25px;
background: #5FA467;
/*
REMOVED: transform: translateY(-50%);
*/
}

html:

<div class="sliderr"><br>
<div class="sliderr__wrapper">
<div class="sliderr__item" style="border: 1px solid #DCE2EC;">
<div style="height: 150px;" class="slid">
<p style="font-family: Roboto; font-size: 14px; color: #5FA467;">My first text</p><br>
<p style="font-family: Roboto; font-size: 16px; color: #000; font-weight: bold;">My second text</p><br>
<p style="display: inline-block; font-family: Roboto; font-size: 14px; color: #000;"><img src="https://via.placeholder.com/20" style="width: 18px; height: 18px;"><span>My User</span><img src="https://via.placeholder.com/20" style="margin-left: 20px;"> 21.08.2018</p>
</div>
</div>

<div class="sliderr__item" style="border: 1px solid #DCE2EC;">
<div style="height: 150px;" class="slid">
<p style="font-family: Roboto; font-size: 14px; color: #5FA467;">My first text</p><br>
<p style="font-family: Roboto; font-size: 16px; color: #000; font-weight: bold;">My second text</p><br>
<p style="display: inline-block; font-family: Roboto; font-size: 14px; color: #000;"><img src="https://via.placeholder.com/20" style="width: 18px; height: 18px;"><span>My User</span><img src="https://via.placeholder.com/20" style="margin-left: 20px;"> 21.08.2018</p>
</div>
</div>
</div>
</div>

所以,我有 3 段文字,在移动版本中,我需要在中心看到它们并在彼此下方看到它们,并且图标需要与它们的文字在彼此下方。我该怎么做?此 JSFiddle 中的完整示例 https://jsfiddle.net/ofzpnL2k/4/

最佳答案

您可以使用 CSS 媒体查询为移动设备实现不同的样式链接。这就像 CSS 的 if 条件。

在这里你可以找到更多关于它的解释:https://www.w3schools.com/csSref/css3_pr_mediaquery.asp .

关于html - 文字在移动版网页中的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55074651/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com