Movatterモバイル変換


[0]ホーム

URL:


CoreUI Angular Logo
Framework:
Getting startedIntroductionSupport CoreUICustomizeSassOptionsCSS VariablesLayoutBreakpointsContainersGridColumnsGuttersFormsOverviewAutocompletePRODate PickerPRODate Range PickerPROForm ControlSelectMulti SelectPROChecks & RadiosPassword InputPRORangeRange SliderPRORatingPROStepperPROInput GroupFloating LabelsLayoutTime PickerPROValidationComponentsAccordionAlertAvatarBadgeBreadcrumbButtonButton GroupCalendarPROCalloutCardCarouselClose buttonCollapseDropdownFooterHeaderImageList GroupLoading ButtonPROModalNavNavbarOffcanvasPaginationPlaceholderPopoverProgressSmart PaginationPROSmart TablePROSidebarSpinnerTableTabsNewToastTooltipWidgetsIconsChartsTemplatesNewAdmin & DashboardDownloadInstallationCustomizeContentMigrationv4 → v5v3 → v4Angular version


DownloadHire UsGet CoreUI PRO
On this page

Angular Grid

Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes thanks to a twelve column system, six default responsive tiers, Sass variables and mixins, and dozens of predefined classes.

Example

CoreUI's grid system uses a series of containers, rows, and columns to layout and align content. It's built withflexbox in newwindow and is fully responsive. Below is an example and an in-depth explanation for how the gridsystem comes together.

One of three columnsOne of three columnsOne of three columns
Loading...
Loading...
Loading...

The above example creates three equal-width columns across all devices and viewports using our predefined gridclasses. Those columns are centered in the page with the parentc-container.

How it works

Breaking it down, here's how the grid system comes together:

  • Our grid supports six responsive breakpoints. Breakpoints are based onmin-width media queries, meaning theyaffect that breakpoint and all those above it (e.g.,[sm]="4" applies tosm,md,lg,xl, andxxl). Thismeans you cancontrol container and column sizing and behavior by each breakpoint.
  • Containers center and horizontally pad your content. Usec-container for a responsive pixel width,c-container fluid forwidth: 100% across all viewports and devices, or a responsive container (e.g.,c-container breakpoint="md") fora combination of fluid and pixel widths.
  • Rows are wrappers for columns. Each column has horizontalpadding (called agutter) for controlling thespace between them. Thispadding is then counteracted on the rows with negative margins to ensure the content inyourcolumns is visually aligned down the left side. Rows also support modifier classes touniformly apply columnsizingandgutter classes to change the spacing of your content.
  • Columns are incredibly flexible. There are 12 template columns available per row, allowing you to createdifferent combinations of elements that span any number of columns. Column classes indicate the number of templatecolumns to span (e.g.,c-col [xs]="4" spans four). Widths are set in percentages so you always have the samerelative sizing.
  • Gutters are also responsive and customizable.Gutter classesare available across all breakpoints, with all thesame sizes as ourmargin and padding spacing. Change horizontal gutterswith.gx-* classes, vertical gutters with.gy-*, or all gutters with.g-* classes..g-0 is also available toremove gutters.

Be aware of the limitations andbugs around flexbox, like theinabilityto use some HTML elements as flex containers.

Grid options

CoreUI grid system can adapt across all six default breakpoints, and any breakpoints you customize. The six defaultgrid tiers are as follow:

  • Extra small (xs)
  • Small (sm)
  • Medium (md)
  • Large (lg)
  • Extra large (xl)
  • Extra extra large (xxl)

As noted above, each of these breakpoints have their own container, unique class prefix, and modifiers. Here's how thegrid changes across these breakpoints:

xs
<576px
sm
≥576px
md
≥768px
lg
≥992px
xl
≥1200px
xxl
≥1400px
Containermax-widthNone (auto)540px720px960px1140px1320px
Class prefix<c-col xs=><c-col sm=><c-col md=><c-col lg=><c-col xl=><c-col xxl=>
# of columns12
Gutter width1.5rem (.75rem on left and right)
Custom guttersYes
NestableYes
Column orderingYes

Auto-layout columns

Utilize breakpoint-specific column classes for easy column sizing without an explicit numbered class likec-col sm="6".

Equal-width

For example, here are two grid layouts that apply to every device and viewport, fromxs toxxl. Add any number ofunit-less classes for each breakpoint you need and every column will be the same width.

1 of 22 of 21 of 32 of 33 of 3
Loading...
Loading...
Loading...

Setting one column width

Auto-layout for flexbox grid columns also means you can set the width of one column and have the sibling columnsautomatically resize around it. You may use predefined grid classes (as shown below), grid mixins, or inline widths.Note that the other columns will resize no matter the width of the center column.

1 of 32 of 3 (wider)3 of 31 of 32 of 3 (wider)3 of 3
Loading...
Loading...
Loading...

Variable width content

Usec-col xs|sm|md|lg|xl="auto" props to size columns based on the natural width of their content.

1 of 3Variable width content3 of 31 of 3Variable width content3 of 3
Loading...
Loading...
Loading...

Responsive classes

CoreUI's grid includes six tiers of predefined classes for building complex responsive layouts. Customize the size ofyour columns on extra small, small, medium, large, or extra large devices however you see fit.

All breakpoints

For grids that are the same from the smallest of devices to the largest, use thec-col andc-col xs= classes.Specify a numbered class when you need a particularly sized column; otherwise, feel free to stick toc-col.

.col.col.col.col.col-8.col-4
Loading...
Loading...
Loading...

Stacked to horizontal

Using a single set ofc-col sm= classes, you can create a basic grid system that starts out stacked and becomes horizontal at the small breakpoint (sm).

.col-sm-8.col-sm-4.col-sm.col-sm.col-sm
Loading...
Loading...
Loading...

Mix and match

Don't want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier asneeded. See the example below for a better idea of how it all works.

.col-md-8.col-6 .col-md-4.col-6 .col-md-4.col-6 .col-md-4.col-6 .col-md-4.col-6.col-6
Loading...
Loading...
Loading...

Row columns

Use the responsivec-row [sm | md | lg | xl | xxl]=* classes to quickly set the number of columns that best render yourcontent and layout. Whereas normalc-col xs= classes apply to the individual columns (e.g.,c-col xs="4"), the rowcolumns classes are set on the parentc-row as a shortcut. With c-rowc-row [sm | md | lg | xl | xxl]="'auto'" you cangive the columns their natural width.

Use these row columns classes to quickly create basic grid layouts or to control your card layouts.

columncolumncolumncolumn
Loading...
Loading...
Loading...
columncolumncolumncolumn
Loading...
Loading...
Loading...
columncolumncolumncolumn
Loading...
Loading...
Loading...
columncolumncolumncolumn
Loading...
Loading...
Loading...
columncolumncolumncolumn
Loading...
Loading...
Loading...
columncolumncolumncolumn
Loading...
Loading...
Loading...

Nesting

To nest your content with the default grid, add a newrow and set of.col-sm-* columns within an existing.col-sm-* column.Nested rows should include a set of columns that add up to 12 or fewer (it is not required that you use all 12 available columns).

Level 1: .col-sm-3 Level 2: .col-8 Level 2: .col-4
Loading...
Loading...
Loading...
---

API reference

Grid Module

import { GridModule } from '@coreui/angular';@NgModule({   imports: [GridModule,]})export class AppModule() { }

c-container

component

Inputs
propdescriptiontypedefaultnotes
fluidSet container 100% wide, spanning the entire width of the viewport.booleanundefined
breakpointSet container 100% wide until{sm|md|lg|xl|xxl} breakpoint.stringundefined

c-row cRow

componentdirective

Inputs
propdescriptiontypedefaultnotes
xsThe number of columns/offset/order on extra small devices (<576px).auto | numberundefined
smThe number of columns/offset/order on extra small devices (<768px).auto | numberundefined
mdThe number of columns/offset/order on extra small devices (<992px).auto | numberundefined
lgThe number of columns/offset/order on extra small devices (<1200px).auto | numberundefined
xlThe number of columns/offset/order on extra small devices (<1400px).auto | numberundefined
xxlThe number of columns/offset/order on extra small devices (≥1400px).auto | numberundefined

gutter

directive for c-row

Inputs
propdescriptiontypedefaultnotes
gutterDefine padding between columns to space and align content responsively in the Bootstrap grid system.(IGutterObjectGutterBreakpointsGutters)

c-col cCol

componentdirective

Inputs
propdescriptiontypedefaultnotes
xsThe number of columns on extra small devices (<576px).auto | number | booleanundefined
smThe number of columns on extra small devices (<768px).auto | number | booleanundefined
mdThe number of columns on extra small devices (<992px).auto | number | booleanundefined
lgThe number of columns on extra small devices (<1200px).auto | number | booleanundefined
xlThe number of columns on extra small devices (<1400px).auto | number | booleanundefined
xxlThe number of columns on extra small devices (≥1400px).auto | number | booleanundefined
offsetOffset grid columnsnumber|{sm|md|lg|xl|xxl}:numberundefined
orderControls the visual order of your columns. Includes support for1 through5 across all six grid tiers."first"|"last"|number|{sm|md|lg|xl|xxl}:numberundefined

CoreUI for Angular is Open Source UI Components Library for Angular.

Currently v5.5.17 Code licensed MIT, docs CC BY 3.0 .
CoreUI PRO requires acommercial license.


[8]ページ先頭

©2009-2025 Movatter.jp