[英]With a minified browser window @media css wrapping to bottom line
Now, at normal browser resolution, the information is displayed like this:现在,在正常浏览器分辨率下,信息显示如下:
But if the browser has a low resolution, then everything is displayed like this:但是如果浏览器的分辨率很低,那么一切都会像这样显示:
How can I move these blocks down with @media
css if the user has a small screen resolution?如果用户的屏幕分辨率较小,如何使用
@media
css 将这些块向下移动? So that there was something like this:所以有这样的事情:
My template code:我的模板代码:
<div class="flex-c">
<div class="jackpot__information" v-if="luckyOfDay">
<div class="widget widget_jackpot widget_luck">
<div class="widget__head">
<div class="widget__title"><i class="icon icon_horseshoe"></i><span> Удача дня </span>
</div>
</div>
<div class="widget__main">
<a class="widget__photo photo" :href="'/user/' + luckyOfDay.winner.uid">
<img class="widget__image image"
:src="luckyOfDay.winner.avatar"
:alt="luckyOfDay.winner.username">
</a>
<div class="widget__information">
<div class="symbol_usd widget__bank">{{ luckyOfDay.total_bank }}</div>
<a class="widget__nickname link" :href="'/user/' + luckyOfDay.winner.uid"> {{ luckyOfDay.winner.username }} </a>
</div>
</div>
<a class="widget__chance link" :href="'/jackpot/history/' + luckyOfDay.game_id"> Шанс {{ luckyOfDay.winner_chance }}% </a>
</div>
</div>
<div class="jackpot__last">
<div class="widget widget_jackpot widget_last_game ng-star-inserted" v-if="lastGame">
<div class="widget__head">
<div class="widget__title"><i class="icon icon_clock"></i><span> Пред. игра </span>
</div>
</div>
<div class="widget__main">
<a class="widget__photo photo" :href="'/user/' + lastGame.winner.uid">
<img class="widget__image image"
:src="lastGame.winner.avatar"
:alt="lastGame.winner.username">
</a>
<div class="widget__information">
<div class="symbol_usd widget__bank">{{ lastGame.total_bank }}</div>
<a class="widget__nickname link" :href="'/user/' + lastGame.winner.uid"> {{ lastGame.winner.username }} </a>
</div>
</div>
<a class="widget__chance link" :href="'/jackpot/history/' + lastGame.game_id"> Шанс {{ lastGame.winner_chance }}% </a>
</div>
</div>
</div>
My CSS code:我的 CSS 代码:
.widget_luck {
position: relative;
width: 164px;
height: 150px;
padding: 18px 20px;
background-color: #213137;
border-radius: 10px
}
.widget_luck .widget__title {
display: block;
color: #eadfc4;
font-size: 14px;
font-weight: 600;
line-height: 16px;
text-transform: uppercase
}
.widget_luck .widget__title .icon {
top: 1px;
font-size: 14px;
margin-right: 6px
}
.widget_luck .widget__main {
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
margin-top: 15px
}
.widget_luck .widget__photo {
width: 35px;
height: 35px
}
.widget_luck .widget__photo .widget__image {
width: 35px;
height: 35px;
max-width: 35px;
max-height: 35px;
border-radius: 10px
}
.widget_luck .widget__information {
display: block;
width: calc(100% - 35px);
padding-left: 10px
}
.widget_luck .widget__bank {
display: block;
color: #f59575;
font-size: 14px;
font-weight: 600;
line-height: 18px;
text-transform: uppercase
}
.widget_luck .widget__nickname {
display: inline-block;
color: #d6ddea;
font-size: 13px;
font-weight: 600;
line-height: 16px;
max-width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden
}
.widget_luck .widget__chance {
display: block;
width: 100%;
height: auto;
margin-top: 11px;
background-color: #182328;
border-radius: 7px;
color: #eadfc4;
font-size: 12px;
font-weight: 600;
line-height: 34px;
text-transform: uppercase;
text-align: center
}
@media (max-width:374px) {
.widget_luck .widget__bank {
font-size: 12px
}
}
@media (max-width:557px) {
.widget_luck .widget__title span {
display: none
}
}
@media (max-width:1365px) {
.widget_luck {
height: 88px;
padding: 13px 15px
}
.widget_luck .widget__title {
font-size: 12px
}
.widget_luck .widget__title .icon {
top: 1px;
font-size: 12px;
margin-right: 5px
}
.widget_luck .widget__main {
margin-top: 10px
}
.widget_luck .widget__chance {
position: absolute;
top: 13px;
right: 10px;
display: inline-block;
width: auto;
height: 18px;
padding: 0 5px;
margin-top: 0;
font-size: 11px;
line-height: 17px;
border-radius: 5px
}
}
@media (min-width:1600px) {
.widget_luck .widget__title {
font-size: 15px;
line-height: 16px
}
.widget_luck .widget__chance {
font-size: 13px;
line-height: 35px
}
}
.widget_last_game {
position: relative;
width: 164px;
height: 150px;
padding: 18px 20px;
background-color: #213137;
border-radius: 10px
}
.widget_last_game .widget__title {
display: block;
color: #eadfc4;
font-size: 15px;
font-weight: 600;
line-height: 16px;
text-transform: uppercase
}
.widget_last_game .widget__title .icon {
top: 1px;
font-size: 14px;
margin-right: 6px
}
.widget_last_game .widget__main {
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
margin-top: 15px
}
.widget_last_game .widget__photo {
width: 35px;
height: 35px
}
.widget_last_game .widget__photo .widget__image {
width: 35px;
height: 35px;
max-width: 35px;
max-height: 35px;
border-radius: 10px
}
.widget_last_game .widget__information {
display: block;
width: calc(100% - 35px);
padding-left: 10px
}
.widget_last_game .widget__bank {
display: block;
color: #f59575;
font-size: 14px;
font-weight: 600;
line-height: 18px;
text-transform: uppercase
}
.widget_last_game .widget__nickname {
display: inline-block;
color: #d6ddea;
font-size: 13px;
font-weight: 600;
line-height: 16px;
max-width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden
}
.widget_last_game .widget__chance {
display: block;
width: 100%;
height: 35px;
margin-top: 11px;
background-color: #182328;
border-radius: 7px;
color: #eadfc4;
font-size: 13px;
font-weight: 600;
line-height: 35px;
text-transform: uppercase;
text-align: center
}
@media (max-width:374px) {
.widget_last_game .widget__bank {
font-size: 12px
}
}
@media (max-width:557px) {
.widget_last_game .widget__title span {
display: none
}
}
@media (max-width:1365px) {
.widget_last_game {
height: 88px;
padding: 13px 15px
}
.widget_last_game .widget__title {
font-size: 12px
}
.widget_last_game .widget__title .icon {
top: 1px;
font-size: 12px;
margin-right: 5px
}
.widget_last_game .widget__main {
margin-top: 10px
}
.widget_last_game .widget__chance {
position: absolute;
top: 13px;
right: 10px;
display: inline-block;
width: auto;
height: 18px;
padding: 0 5px;
margin-top: 0;
font-size: 11px;
line-height: 17px;
border-radius: 5px
}
}
I've tried different methods of inserting into different @media css where the dimensions are already set, but it didn't work for me.我尝试了不同的方法来插入不同的@media css,其中尺寸已经设置,但它对我不起作用。 Please tell me, I will be grateful!
请告诉我,我将不胜感激!
As requested, a simple example of css-grid in combination with media queries.根据要求,一个简单的 css-grid 示例与媒体查询相结合。
body { margin: 0; padding: 20px; display: grid; grid-gap: 20px; } @media only screen and (max-width: 480px) { body { grid-template-columns: repeat(2, 1fr); } } @media only screen and (min-width: 481px) { body { grid-template-columns: repeat(4, 1fr); } }.grid-span-2 { grid-column: span 2; } div { border: 1px solid black; padding: 5px; }
<div class="grid-span-2">Widget 1</div> <div class="grid-span-1">Widget 2</div> <div class="grid-span-1">Widget 3</div>
In this example you have 3 boxes/widgets as in your picture.在此示例中,您有 3 个框/小部件,如您的图片所示。 The are layout next to each other if the screen size is 481px or above as the body is divided into 4 columns.
如果屏幕尺寸为 481 像素或以上,则布局彼此相邻,因为主体分为 4 列。 The 1st widtget always span 2 columns.
第一个小部件始终跨越 2 列。
If the screen size is below 481px, then the body is reduced to 2 columns.如果屏幕尺寸低于 481 像素,则正文将减少为 2 列。 This will force the 2nd and 3rd box/widget to drop down into a 2nd row as they no further fit in the first row.
这将迫使第二和第三个框/小部件下降到第二行,因为它们不再适合第一行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.