gpt4 book ai didi

jquery - HTML CSS 响应式 Div Bootstrap

转载 作者:太空宇宙 更新时间:2023-11-04 01:54:28 24 4
gpt4 key购买 nike

我目前有一些 div 在台式机或平板电脑上显示效果很好: enter image description here

但是,当我将它缩小到移动 View 时,它们看起来很糟糕并且没有正确地重新定位:

enter image description here

我真的希望它们能够自动调整,这样当它们在平板设备上时它们显示一行 3,而在移动设备上它们显示一行 2,如下所示:

enter image description here

这似乎正是 col-xs-6 在 bootstrap 中的作用,但是当我添加它时,它似乎不起作用。

这是 HTML:

<div id="surveys" class="surveys col-xs-12"><div>
<div class="col-xs-12">
<div class="row">
<div class="col-xs-12" id="title">
<h4 style="text-transform: uppercase;">Surveys</h4>
<h5 class="sub-title">The Best Way to Get Free Coins</h5>
</div>
<div id="surveys-list" class="col-xs-12"><div>
<div id="surveys-list-container"><div class="survey-item">
<div id="2697033" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box"><div>

<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">49</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div></div>
<div id="loi-box" class="loi-box"><div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">10 min survey</span>
</div></div>
</div>
</div><div class="survey-item">
<div id="2697013" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box"><div>

<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">85</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div></div>
<div id="loi-box" class="loi-box"><div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">20 min survey</span>
</div></div>
</div>
</div><div class="survey-item">
<div id="2697207" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box"><div>

<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">85</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div></div>
<div id="loi-box" class="loi-box"><div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">18 min survey</span>
</div></div>
</div>
</div><div class="survey-item">
<div id="2697031" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box"><div>

<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">85</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div></div>
<div id="loi-box" class="loi-box"><div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">10 min survey</span>
</div></div>
</div>
</div><div class="survey-item">
<div id="2697999" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box"><div>

<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">87</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div></div>
<div id="loi-box" class="loi-box"><div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">18 min survey</span>
</div></div>
</div>
</div><div class="survey-item">
<div id="2697687" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box"><div>

<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">85</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div></div>
<div id="loi-box" class="loi-box"><div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">10 min survey</span>
</div></div>
</div>
</div></div>
</div></div>
</div>
</div>
</div></div>

还有 CSS:

#surveys h4 {
font-family: Montserrat-Bold;
letter-spacing: .1em;
margin-top: 16px;
margin-bottom: 8px;
}

#surveys h4 {
text-transform: uppercase;
color: #555555;
font-size: 18px;
font-weight: bold;
line-height: 1.1;
font-family: Montserrat-Regular, Verdana, sans-serif;
}

#surveys .sub-title {
margin-bottom: 16px;
margin-top: 0px;
color: #777777;
font-size: 14px;
font-family: inherit;
font-weight: 800;
line-height: 1.1;
font-family: Montserrat-Regular, Verdana, sans-serif;
}

#surveys .survey-item {
float: left;
width: 19.2%;
display: block;
margin: 5px 0.8% 5px 0;
border-radius: 7px 7px 6px 6px;
border-width: 1px;
border-style: solid;
position: relative;
cursor: pointer;
background-color: #FFFFFF;
border-color: #dddddd;
-moz-box-shadow: 0 2px 0 0 #cccccc;
-webkit-box-shadow: 0 2px 0 0 #cccccc;
box-shadow: 0 2px 0 0 #cccccc;
font-family: Montserrat-Regular, Verdana, sans-serif;
height: 100%;
overflow-y: visible;
background-color: #FFFFFF;
-webkit-font-smoothing: antialiased;
font-size: 14px;
line-height: 1.42857;
color: #333333;
background-color: #fff;
}

#surveys .survey-item {
float: left;
width: 19.2%;
display: inline-block;
margin: 5px 0.8% 5px 0;
border-radius: 7px 7px 6px 6px;
border-width: 1px;
border-style: solid;
position: relative;
cursor: pointer;
background-color: #FFFFFF;
border-color: #dddddd;
-moz-box-shadow: 0 2px 0 0 #cccccc;
-webkit-box-shadow: 0 2px 0 0 #cccccc;
box-shadow: 0 2px 0 0 #cccccc;
}

#offers .note, #surveys .note {
display: none;
font-family: Montserrat-Bold, Verdana, sans-serif;
font-weight: bold;
font-size: 0.625em;
position: absolute;
right: -0.5em;
line-height: 2;
border-left-width: 10px;
border-left-style: solid;
border-right-width: 5px;
border-right-style: solid;
color: #139493;
background-color: #a5e2e1;
border-left-color: #a5e2e1;
border-right-color: #a5e2e1;
box-shadow: 0 1px 0 0 #dddddd;
-moz-box-shadow: 0 1px 0 0 #dddddd;
-webkit-box-shadow: 0 1px 0 0 #dddddd;
}

#surveys .reward-box {
font-family: BebasNeue, Impact, sans-serif;
font-weight: normal;
font-size: 1.875em;
/*padding: 10.2px;*/
border-top-left-radius: 6px;
border-top-right-radius: 6px;
background-color: #17b4b3;
}

#surveys .reward-box .amount {
color: #f6fcfc;
position: relative;
width: 100%;
display: inline-block;
letter-spacing: 0.0125em;
white-space: nowrap;
margin: 0 0 10px;
margin-bottom: 0;

}

#surveys .reward-box .value {
font-size: 2em;
font-weight: bold;
vertical-align: sub;
margin: 3%;
display: inline-block;
padding-bottom: .5em;
}

#surveys .reward-box .currency {
color: #d1f0f0;
position: relative;
/*width: 50%;*/
vertical-align: middle;
text-align: right;
font-family: Montserrat-Bold, Verdana, sans-serif;
font-weight: bold;
font-size: 11px;
display: inline-block;
text-overflow: ellipsis;
overflow: hidden;
max-height: 2.8em;
white-space: normal;
}

#surveys .loi-box {
font-family: Montserrat-Bold, Verdana, sans-serif;
font-weight: bold;
font-size: 0.75em;
text-transform: capitalize;
text-indent: -2em;
}

#surveys .loi-box .duration {
vertical-align: middle;
font-family: Montserrat-Bold, Verdana, sans-serif;
font-weight: normal;
font-size: 12px;
padding: 8px 0;
text-transform: capitalize;
text-indent: -2em;
color: #888888;
line-height: 16.8px;
letter-spacing: .01em;
}

#reward-box {
padding: 0px;
}

#surveys .reward-box i {
color: #4ac5c4;
margin-right: -3px;
font-size: 1.3em;
vertical-align: middle;
display: inline;
letter-spacing: 0.0125em;
white-space: nowrap;
/*margin-bottom: 1em;*/
}

#intro-description {
width: 50% !important;
}

#surveys-list-container {
display: block;
float: left;
width: 100%;
position: relative;
margin-bottom: 16px;
}

我有什么想法可以调整它以便它们响应地移动吗?

谢谢!

编辑 - 添加带有附加 rowcol-xs-6 的 html 代码以及结果输出:

<div id="surveys" class="surveys col-xs-12">
<div>
<div class="col-xs-12">
<div class="row">
<div class="col-xs-12" id="title">
<h4 style="text-transform: uppercase;">Surveys</h4>
</div>
<div id="surveys-list" class="col-xs-12">
<div>
<div id="surveys-list-container row">
<div class="survey-item col-md-3 col-xs-6">
<div id="2697033" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box">
<div>
<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">49</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div>
</div>
<div id="loi-box" class="loi-box">
<div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">10 min survey</span>
</div>
</div>
</div>
</div>
<div class="survey-item col-md-3 col-xs-6">
<div id="2697013" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box">
<div>

<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">85</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div>
</div>
<div id="loi-box" class="loi-box">
<div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">20 min survey</span>
</div>
</div>
</div>
</div>
<div class="survey-item col-md-3 col-xs-6">
<div id="2697033" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box">
<div>
<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">49</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div>
</div>
<div id="loi-box" class="loi-box">
<div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">10 min survey</span>
</div>
</div>
</div>
</div>
<div class="survey-item col-md-3 col-xs-6">
<div id="2697013" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box">
<div>

<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">85</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div>
</div>
<div id="loi-box" class="loi-box">
<div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">20 min survey</span>
</div>
</div>
</div>
</div>
<div class="survey-item col-md-3 col-xs-6">
<div id="2697033" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box">
<div>
<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">49</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div>
</div>
<div id="loi-box" class="loi-box">
<div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">10 min survey</span>
</div>
</div>
</div>
</div>
<div class="survey-item col-md-3 col-xs-6">
<div id="2697013" class="item survey">
<span class="note new">&nbsp;Opened&nbsp;</span>
<div id="reward-box" class="reward-box">
<div>

<p class="amount">
<i class="fa fa-plus"></i>

<span class="value">85</span>
<span class="currency">reward points</span>
<span class="hidden">+More</span>
</p>
</div>
</div>
<div id="loi-box" class="loi-box">
<div class="loi">
<img src="http://d34x0w7b7efh78.cloudfront.net/pl/js/iFrameV4/images/customizable/Iframe_icon-survey-LOI.svgx?publisherId=8549&amp;style=8e0056f626fc736c93d0e68f08b14008" width="20" height="20">
<span class="duration">20 min survey</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

笔记本电脑(它似乎只是在 div 的外部添加填充): enter image description here

移动端(似乎只是把它揉得更紧): enter image description here

编辑 - 我认为有问题的 CSS 就在这里,当我重新添加它时,它似乎破坏了功能:

#surveys .survey-item {
float: left;
width: 19.2%;
display: inline-block;
margin: 5px 0.8% 5px 0;
border-radius: 7px 7px 6px 6px;
border-width: 1px;
border-style: solid;
position: relative;
cursor: pointer;
background-color: #FFFFFF;
border-color: #dddddd;
-moz-box-shadow: 0 2px 0 0 #cccccc;
-webkit-box-shadow: 0 2px 0 0 #cccccc;
box-shadow: 0 2px 0 0 #cccccc;
padding-left: 0px;
padding-right: 0px;
}

最佳答案

自定义 CSS 中有几处会导致问题。主要与设置每个元素的宽度和边距有关。只需让每个元素填充 col-*..

#surveys .survey-item {
display: block;
margin: 5px 0;
border-radius: 7px 7px 6px 6px;
border-width: 1px;
border-style: solid;
position: relative;
cursor: pointer;
background-color: #FFFFFF;
border-color: #dddddd;
-moz-box-shadow: 0 2px 0 0 #cccccc;
-webkit-box-shadow: 0 2px 0 0 #cccccc;
box-shadow: 0 2px 0 0 #cccccc;
}

我还清理了 HTML。有很多嵌套级别。只需确保 col 始终是“行”的直接子元素即可。

http://www.codeply.com/go/dqgFudTPTU

关于jquery - HTML CSS 响应式 Div Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42845277/

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