Zurb foundation 如何使用Zurb基金会做50% / 50%移动栏和固定间距桌面栏?
这可能是一个典型的选择面板,位于桌面上: 在手机上: Zurb基金会能做到这一点吗?我认为一个问题是,对于中等宽度及以上,两列的宽度应该是固定的,而不是动态的。(选项2可以有长宽或短宽,因为背景是透明的,不会显示。重要的是选项1、垂直分隔线和选项2之间的固定间距) 我在CodePen上设置了一些期望的行为,虽然它们是为桌面和移动设备定制的,但不能同时为两者: 桌面:Zurb foundation 如何使用Zurb基金会做50% / 50%移动栏和固定间距桌面栏?,zurb-foundation,zurb-foundation-5,Zurb Foundation,Zurb Foundation 5,这可能是一个典型的选择面板,位于桌面上: 在手机上: Zurb基金会能做到这一点吗?我认为一个问题是,对于中等宽度及以上,两列的宽度应该是固定的,而不是动态的。(选项2可以有长宽或短宽,因为背景是透明的,不会显示。重要的是选项1、垂直分隔线和选项2之间的固定间距) 我在CodePen上设置了一些期望的行为,虽然它们是为桌面和移动设备定制的,但不能同时为两者: 桌面: 流动电话: 流动电话: <div class="row text-center"> <div class
流动电话: 流动电话:
<div class="row text-center">
<div class="small-6 column">Choice 1</div>
<div class="small-6 column">Choice 2</div>
</div>
选择1
选择2
而且似乎没有办法按照桌面的固定间距来设计它
现在我可以使用普通CSS来格式化桌面版本,然后使用媒体查询来对移动版本进行格式化,而不使用ZURB基金会。基金会既可用于移动台又可用于桌面,也可用于一种情况下的基础,另一种情况下使用媒体查询?
< P>只需将其写入SCSS,将其编译成CSS并使用普通CSS。此SCSS代码可以实现以下功能:.column {
background: #ffc;
color: #333;
padding: 20px;
@media #{$small-only} {
width: 50%;
}
&:first-child {
border-right: 1px solid #bbb;
@media #{$medium-up} {
width: 200px;
}
}
&:last-child {
@media #{$medium-up} {
width: calc(100% - 200px);
}
}
}
编译CSS:
body {
padding-top: 50px;
}
.column {
background: #ffc;
color: #333;
padding: 20px;
}
@media only screen and (max-width: 40em) {
.column {
width: 50%;
}
}
.column:first-child {
border-right: 1px solid #bbb;
}
@media only screen and (min-width: 40.0625em) {
.column:first-child {
width: 200px;
}
}
@media only screen and (min-width: 40.0625em) {
.column:last-child {
width: calc(100% - 200px);
}
}
更新的HTML:
<div class="row text-center">
<div class="column">Choice 1</div>
<div class="column">Choice 2</div>
</div>
选择1
选择2
只需在SCSS中编写,编译成CSS并使用普通CSS即可。此SCSS代码可以实现以下功能:
.column {
background: #ffc;
color: #333;
padding: 20px;
@media #{$small-only} {
width: 50%;
}
&:first-child {
border-right: 1px solid #bbb;
@media #{$medium-up} {
width: 200px;
}
}
&:last-child {
@media #{$medium-up} {
width: calc(100% - 200px);
}
}
}
编译CSS:
body {
padding-top: 50px;
}
.column {
background: #ffc;
color: #333;
padding: 20px;
}
@media only screen and (max-width: 40em) {
.column {
width: 50%;
}
}
.column:first-child {
border-right: 1px solid #bbb;
}
@media only screen and (min-width: 40.0625em) {
.column:first-child {
width: 200px;
}
}
@media only screen and (min-width: 40.0625em) {
.column:last-child {
width: calc(100% - 200px);
}
}
更新的HTML:
<div class="row text-center">
<div class="column">Choice 1</div>
<div class="column">Choice 2</div>
</div>
选择1
选择2
在“选项1”列中添加一个额外的类,并添加一条规则,将断点宽度设置为中等及以上的固定值。如果使用SASS版本的基础,非常容易做。将一个额外的类添加到“选择1”栏中,并添加一个规则,该规则将宽度设置为断点中和上的固定值。非常容易做到,如果你使用的ASS版本的基金会。