1. Trang chủ
  2. » Tất cả

Bootstrap 5 02 layout

50 1 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Bootstrap 5 Layout
Trường học Getbootstrap.com
Chuyên ngành Web Development
Thể loại Documentation
Năm xuất bản 2023
Định dạng
Số trang 50
Dung lượng 2,11 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

VARIABLE WIDTH CONTENT▪ Use col-{breakpoint}-auto classes to size columns based on the natural width of their content... ROW COLUMNS▪ Use the responsive .row-cols-* classes to quickly se

Trang 1

BOOTSTRAP 5

Layout

( H T T P S : / / G E T B O O T S T R A P C O M / D O C S / 5 1 / L A Y O U T / )

Trang 3

1 BREAKPOINTS

▪ Breakpoints are customizable widths that determine how your responsive layout behaves across device or viewport sizes in Bootstrap

Trang 4

MEDIA QUERIES

Trang 6

2 CONTAINERS

▪ Containers are a fundamental building block of Bootstrap that contain, pad, and align your content within a given device or viewport

Trang 7

3 GRID SYSTEM

3.1 Example

3.2 Grid options

3.3 Auto-layout columns3.4 Responsive classes3.5 Nesting

Trang 8

3.1 EXAMPLE

Trang 9

3.2 GRID OPTIONS

Bootstrap’s grid system can adapt across all six default breakpoints, and any breakpoints you customize The six default grid tiers are as follow:

Trang 11

3.3 AUTO-LAYOUT COLUMNS

Utilize breakpoint-specific column classes for easy column sizing without an explicit numbered class like col-sm-6

3.3.1 Equal-width

3.3.2 Setting one column width

3.3.3 Variable width content

Trang 12

3.3.1 EQUAL-WIDTH

Trang 13

3.3.2 SETTING ONE COLUMN WIDTH

Trang 14

3.3.3 VARIABLE WIDTH CONTENT

▪ Use col-{breakpoint}-auto classes to size columns based on the natural width of their content

Trang 15

3.4 RESPONSIVE CLASSES

3.4.1 All breakpoints

3.4.2 Mix and match

3.4.3 Row columns

Trang 16

3.4.1 ALL BREAKPOINTS

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

Trang 17

3.4.2 MIX AND MATCH

Use a combination of different classes for each tier as needed See the example below for a better idea of how it all works.

Trang 18

3.4.3 ROW COLUMNS

▪ Use the responsive row-cols-* classes to quickly set the number of columns that best render your content and layout

Trang 22

3.5 NESTING

To nest your content with the default grid, add a new row and set of col-sm-* columns within an existing col-sm-* column

Trang 23

4 COLUMN

Learn how to modify columns with a handful of options for alignment, ordering, and offsetting thanks to our flexbox grid system

4.1 Alignment

4.2 Reordering

Trang 25

4.1.1 VERTICAL ALIGNMENT

Trang 27

4.1.2 HORIZONTAL ALIGNMENT

Trang 29

4.2 REORDERING

4.2.1 Order classes

4.2.2 Offsetting columns

Trang 30

4.2.1 ORDER CLASSES

Use order- classes for controlling the visual order of your content These classes are responsive, so you can set the order by breakpoint (e.g., order-1.order-md-2) Includes support for 0 through 5 across all six grid tiers

Trang 32

4.2.2 OFFSETTING COLUMNS

Move columns to the right using offset-md-* classes These classes increase the left margin of a column by * columns For example, offset-md-4 moves col-md-4 over four

columns

Trang 34

5 GUTTERS

Gutters are the padding between your columns, used to responsively space and align content in the Bootstrap grid system

5.1 Horizontal gutters

5.2 Vertical gutters

5.3 Horizontal & vertical gutters

5.4 No gutters

Trang 35

5.1 HORIZONTAL GUTTERS

.gx-* classes can be used to control the horizontal gutter widths Includes support for 0 through 5 across all six grid tiers

Trang 36

5.2 VERTICAL GUTTERS

.gy-* classes can be used to control the vertical gutter widths

Trang 37

5.3 HORIZONTAL & VERTICAL GUTTERS

.g-* classes can be used to control the horizontal gutter

widths

Trang 38

5.4 NO GUTTERS

The gutters between columns in our predefined grid classes can be removed with g-0

Trang 39

6 UTILITIES FOR LAYOUT

6.1 Changing display

6.2 Margin & padding

Trang 40

6.1 CHANGING DISPLAY

Use our display utilities for responsively toggling common

values of the display property Mix it with our grid system,

content, or components to show or hide them across specific viewports

6.1.1 Notation

6.1.2 Examples

6.1.3 Hiding elements

Trang 41

.d-{breakpoint}-{value} for sm, md, lg, xl and xxl.

Where value is one of:

table-row flex inline-flex

Trang 42

6.1.2 EXAMPLES

Trang 43

▪ To hide elements simply use the d-none class or one of the

.d-{sm,md,lg,xl,xxl}-none classes for any responsive screen variation.

▪ To show an element only on a given interval of screen sizes you can

combine one d-*-none class with a d-*-* class, for example none md-block d-xl-none d-xxl-none will hide the element for all screen sizes except on medium and large devices.

Trang 45

.d-6.2 MARGIN & PADDING

Assign responsive-friendly margin or padding values to an element or a subset of its sides with shorthand classes

Includes support for individual properties, all properties, and vertical and horizontal properties Classes are built from a default Sass map ranging from 25rem to 3rem

6.2.1 Notation

6.2.2 Example

6.2.3 Horizontal centering

Trang 46

6.2.1 NOTATION

The classes are named using the format:

{property}{sides}-{size} for xs

{property}{sides}-{breakpoint}-{size} for sm , md , lg , xl and xxl

▪ Where property is one of:

m - for classes that set margin p - for classes that set padding

▪ Where sides is one of:

t - for classes that set margin-top or padding-top

b - for classes that set margin-bottom or padding-bottom

s - for classes that set margin-left or padding-left in LTR & vice versa in RTL

e - for classes that set margin-right or padding-right in LTR & vice versa in RTL

x - for classes that set both *-left and *-right

y - for classes that set both *-top and *-bottom

blank - for classes that set a margin or padding on all 4 sides of the element

Trang 47

Where size is one of:

0 - for classes that eliminate the margin or padding by setting it to 0

1 - (by default) for classes that set the margin or padding to $spacer * 25

2 - (by default) for classes that set the margin or padding to $spacer * 5

3 - (by default) for classes that set the margin or padding to $spacer

4 - (by default) for classes that set the margin or padding to $spacer * 1.5

5 - (by default) for classes that set the margin or padding to $spacer * 3 auto - for classes that set the margin to auto

Trang 48

6.2.2 EXAMPLE

Trang 49

6.2.3 HORIZONTAL CENTERING

Additionally, Bootstrap also includes an mx-auto class for

horizontally centering fixed-width block level content—that is, content that has display: block and a width set—by setting the horizontal margins to auto

Trang 50

THE END

Ngày đăng: 09/02/2023, 15:33

w