zurb是什么网站
ZURB's Foundation 5 has a ton of great features. The one that you will probably use the most in your own websites and applications is the grid. If you are coming from a Bootstrap background, you may be familiar with that grid system already and love its ease of use and functionality.
Today we'll be looking at Foundation 5's grid system and all the great features it has. Foundation hasZURB的Foundation 5具有许多出色的功能。 网格可能是您在自己的网站和应用程序中使用最多的一种网格 。 如果您来自Bootstrap背景,那么您可能已经熟悉该网格系统,并且喜欢它的易用性和功能。
今天,我们将研究Foundation 5的网格系统及其所有强大的功能。 Foundation的 class names that are a little different than Bootstrap, but work in the same way. It also has some neat 类名与Bootstrap略有不同,但工作方式相同。 它还具有一些简洁的 advanced features and great 高级功能和出色的 visiblity classes to show and hide elements based on the situation. Let's jump right in and start using the Foundation grid system. 可见性类,可以根据情况显示和隐藏元素。 让我们直接进入并开始使用Foundation网格系统。<div class="row">
<div class="small-4 columns">one-third</div>
<div class="small-4 columns">one-third</div>
<div class="small-4 columns">one-third</div>
</div>
See the Pen Foundation 5 Basic Grid Showcase by Chris Sevilleja (@sevilayha) on CodePen.
This will generate 3 columns. Notice how there is a max-width set for the row. Unlike Bootstrap, we won't have to encompass our rows inside of a.container
class.
.row
class. Easy enough. The columns are created using the css classes:
.small-#
,
.medium-#
, and
.large-#
. The #s have to add up to be 12 since Foundation uses a
12 grid system. Also, a class that has to be attached to columns is
.column
or
.columns
. They both do the same thing. You can define any combination of layouts using the
.row
and
.small/medium/large-#
classes. The
docs show a great deal of examples, so take a look over there for inspiration. If you need more help like having prebuilt pages and rows for you, take a look at
Foundation's templates. These are a great starting point.
ems
and not
pixels
. These media queries can be found on the
media query docs. Take a look at the media queries and the comments to understand how Foundation breaks down our site.
.row
inside of a
.column
and build out your grid like you normally would. Here's some code and an example:
<div class="row text-center">
<div class="small-4 columns">one-third</div>
<div class="small-4 columns">
<div class="row">
<div class="small-6 columns">half of one-third</div>
<div class="small-6 columns">half of one-third</div>
</div>
</div>
<div class="small-4 columns">one-third</div>
</div>
See the Pen Foundation 5 Nested Grid Showcase by Chris Sevilleja (@sevilayha) on CodePen.
请参阅CodePen上的Chris Sevilleja ( @sevilayha ) 撰写的Pen Foundation 5 Basic Grid Showcase 。
这将生成3列。 注意如何为该行设置最大宽度。 与Bootstrap不同,我们不必将行包含在.container
类中。
.row
类定义的。 很简单。 这些列是使用CSS类创建的:
.small-#
.medium-#
和
.large-#
。 由于Foundation使用
12个网格系统,因此#的总数必须为
12 。 同样,必须附加到列的类是
.column
或
.columns
。 他们俩都做同样的事情。 您可以使用
.row
和
.small/medium/large-#
类定义布局的任意组合。 该
文档显示了大量示例,因此请查看那里的启发。 如果您需要更多帮助,例如为您预建页面和行,请查看
Foundation的模板 。 这些是一个很好的起点。
ems
而不是
pixels
定义的。 这些媒体查询可以在
媒体查询文档中找到 。 查看媒体查询和评论,以了解Foundation如何分解我们的网站。
// Small screens
@media only screen { } /* Define mobile styles */
/* max-width 640px, mobile-only styles, use when QAing mobile issues */
@media only screen and (max-width: 40em) { }
/* ------------------------------------------
Medium screens
min-width 641px, medium screens
*/ ------------------------------------------
@media only screen and (min-width: 40.063em) { }
/* min-width 641px and max-width 1024px, use when QAing tablet-only issues */
@media only screen and (min-width: 40.063em) and (max-width: 64em) { }
/* ------------------------------------------
Large screens
min-width 1025px, large screens
*/ ------------------------------------------
@media only screen and (min-width: 64.063em) { }
/* min-width 1025px and max-width 1440px, use when QAing large screen-only issues */
@media only screen and (min-width: 64.063em) and (max-width: 90em) { }
/* ------------------------------------------
XLarge screens
min-width 1441px, xlarge screens
*/ ------------------------------------------
@media only screen and (min-width: 90.063em) { }
/* min-width 1441px and max-width 1920px, use when QAing xlarge screen-only issues */
@media only screen and (min-width: 90.063em) and (max-width: 120em) { }
/* ------------------------------------------
XXLarge screens
min-width 1921px, xxlarge screens
*/ ------------------------------------------
@media only screen and (min-width: 120.063em) { }
.row
一个内部
.column
,打造出网格就像你通常会。 这是一些代码和示例:
请参阅CodePen上Chris Sevilleja ( @sevilayha ) 撰写的Pen Foundation 5嵌套网格展示 。
.small
,
.medium
, and
.large
classes, we are able to define different grids at different sizes. Let's say to have
2 columns on small devices and
3 columns on medium and large devices. We can do this by defining multiple classes on the same column.
<div class="row text-center">
<div class="small-6 medium-4 columns">column 1</div>
<div class="small-6 medium-4 columns">column 2</div>
<div class="show-for-medium-up medium-4 columns">only shows on medium and up</div>
</div>
See the Pen Foundation 5 Dynamic Grid Showcase by Chris Sevilleja (@sevilayha) on CodePen.
By resizing your browser, you can see the different configurations that we have defined..end
class to your last column.
See the Pen Foundation 5 Incomplete Rows Showcase by Chris Sevilleja (@sevilayha) on CodePen.
.small-offset-#
,
.medium-offset-#
, or
.large-offset-#
) we are able to "offset" a column that many spaces.
<div class="row text-center">
<div class="small-2 columns">column 1</div>
<div class="small-2 small-offset-3 columns">column 2</div>
<div class="small-2 columns">go right</div>
</div>
See the Pen Foundation 5 Offsets Showcase by Chris Sevilleja (@sevilayha) on CodePen.
.small-centered
or
.large-centered
classes. Also, if you center something on small devices but want it to be normal on large devices, just add
.large-uncentered
.
See the Pen Foundation 5 Grid Centered Showcase by Chris Sevilleja (@sevilayha) on CodePen.
.small
,
.medium
和
.large
类,我们可以定义不同大小的不
.large
格。 假设
在小型设备上有
2列,
在中型和大型设备上有3列 。 我们可以通过在同一列上定义多个类来做到这一点。
见笔基金会5动态电网展示克里斯Sevilleja( @sevilayha上) CodePen 。
通过调整浏览器的大小,您可以看到我们定义的不同配置。.end
类添加到最后一列。
<div class="row text-center">
<div class="small-2 columns">column 1</div>
<div class="small-2 columns">column 2</div>
<div class="small-2 columns">go right</div>
</div>
<div class="row text-center">
<div class="small-2 columns">column 1</div>
<div class="small-2 columns">column 2</div>
<div class="small-2 end columns">stay here</div>
</div>
请参阅CodePen上的Chris Sevilleja ( @sevilayha ) 撰写的Pen Foundation 5 Incomplete Rows Showcase 。
.small-offset-#
offset
.small-offset-#
.medium-offset-#
或
.large-offset-#
),我们可以“偏移”具有很多空格的列。
请参阅CodePen上Chris Sevilleja ( @sevilayha ) 撰写的Pen Foundation 5 Offsets Showcase 。
.small-centered
或
.large-centered
类在Foundation中可以轻松完成此
.small-centered
。 另外,如果您将某些内容放在小型设备上但希望在大型设备上正常显示,则只需添加
.large-uncentered
。
请参阅CodePen上的Chris Sevilleja ( @sevilayha ) 撰写的Pen Foundation 5 Grid Centered Showcase 。
.show-for-small-only
.show-for-medium-up
.show-for-medium-only
.show-for-large-up
.show-for-large-only
.show-for-xlarge-up
.show-for-xlarge-only
.show-for-xxlarge-up
.hide-for-small-only
.hide-for-medium-up
.hide-for-medium-only
.hide-for-large-up
.hide-for-large-only
.hide-for-xlarge-up
.hide-for-xlarge-only
.hide-for-xxlarge-up
.show-for-landscape
.show-for-portrait
.show-for-touch
.hide-for-touch
.show-for-small-only
.show-for-medium-up
.show-for-small-only
.show-for-medium-up
.show-for-medium-only
.show-for-large-up
.show-for-medium-only
.show-for-large-up
.show-for-large-only
.show-for-xlarge-up
.show-for-large-only
.show-for-xlarge-up
.show-for-xlarge-only
.show-for-xxlarge-up
.hide-for-small-only
.hide-for-medium-up
.hide-for-medium-only
.hide-for-large-up
.hide-for-large-only
.hide-for-xlarge-up
.hide-for-xlarge-only
.hide-for-xxlarge-up
.show-for-landscape
.show-for-portrait
.show-for-touch
.hide-for-touch
翻译自: https://scotch.io/tutorials/understanding-zurb-foundation-5s-grid-system
zurb是什么网站