gpt4 book ai didi

html - 如何为网络和移动设备使用两种不同的设计

转载 作者:行者123 更新时间:2023-11-28 05:17:04 25 4
gpt4 key购买 nike

我希望能够为我的网页提供特定的设计,并在调整到移动设备大小时使用不同的设计。我将附上照片以更好地解释。

这是我想用于的设计 Web这是草图 Mobile我现在不完全确定如何使用媒体查询这是到目前为止的代码

HTML 婴幼儿 2岁以上 child

    <div class="row">
<div class="full-time col-sm-12 col-md-12 col-lg-2">Full Time</div>
<div class="prices-left-box col-sm-12 col-md-12 col-lg-5">
<div class="prices-left">$200 Per Week</div>
</div>
<div class="prices-right-box col-sm-12 col-md-12 col-lg-5">
<div class="prices-right">$150 Per Week</div>
</div>
</div>
<div class="row">
<div class="full-time col-sm-12 col-md-12 col-lg-2">Up to 4 Hours</div>
<div class="prices-left-box col-sm-12 col-md-12 col-lg-5">
<div class="prices-left">$125 Per Week</div>
</div>
<div class="prices-right-box col-sm-12 col-md-12 col-lg-5">
<div class="prices-right">$100 Per Week</div>
</div>
</div>
</div>

和 CSS:

@media (max-width: 992px) {
.infants{
color: black;
background-color: #7FC7AF;
font-size: 36px;
font-weight: bold;
font-family: "open sans";
height: 125px;
width: 304.3px;
text-align: center;
margin: auto;
display: inline-block;
}

.children{
color: black;
background-color: #FF9E9D;
font-size: 36px;
font-weight: bold;
font-family: "open sans";
height: 125px;
width: 304.4px;
text-align: center;
padding: auto;
display: inline-block;
}
}

.infants{
color: white;
background-color: #7FC7AF;
font-size: 36px;
font-weight: bold;
font-family: "open sans";
height: 87px;
width: 304.3px;
text-align: center;
}

.infants-box{
padding-left: 176px;
padding-right: 80px;
}

.children{
color: white;
background-color: #FF9E9D;
font-size: 36px;
font-weight: bold;
font-family: "open sans";
height: 87px;
width: 304.4px;
text-align: center;
}

.payment-method{
font-size: 24px;
padding-bottom: 57px;
padding-top: 57px;
text-align: center;
font-family: "Source Sans Pro";
font-weight: 600;
font-style: italic;
font-size: 24px;
line-height: 30px;
color: #4B4B4B
}

.full-time{
background-color: #454545;
color: white;
font-size: 24px;
font-weight: bold;
font-family: "open sans";
height: 150px;
margin: auto;
width: 176px;
text-align: center;
}
.prices-left-box{
background-color: white;
width: 304.4px;
height: 150px;
}
.prices-left{
font-family: "source sans pro";
font-size: 24px;
width: 304.3px;
margin-right: 220px;
text-align: center;
}

.prices-right-box{
background-color: #ffffff;
width: 304.4px;
margin-left: 10%;
height: 150px
}

.prices-right{
font-family: "source sans pro";
font-size: 24px;
background color: white !important;
text-align: center;
}
.background-pricing{
background-color: #F0F0F0;
padding-bottom: 84px;
}

最佳答案

如果您使用的是 Bootstrap , 仅引用 grid并将更改应用于所引用的类名。您还可以看到这些 Responsive Utilities在文档中:

如果您确实需要使用上面的代码,请尝试像这样重写上面的代码段:

@media only screen and (max-width: 992px) {
.infants{
/*
Custom CSS here
...
*/
}
}

关于html - 如何为网络和移动设备使用两种不同的设计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39260447/

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