- 入门
- 核心概念
- 定制
- Base Styles
- 布局
- Flexbox & Grid
- Flex Basis
- Flex Direction
- Flex Wrap
- Flex
- Flex Grow
- Flex Shrink
- Order
- Grid Template Columns
- Grid Column Start / End
- Grid Template Rows
- Grid Row Start / End
- Grid Auto Flow
- Grid Auto Columns
- Grid Auto Rows
- Gap
- Justify Content
- Justify Items
- Justify Self
- Align Content
- Align Items
- Align Self
- Place Content
- Place Items
- Place Self
- 间隔
- 尺寸
- 排版
- Font Family
- Font Size
- Font Smoothing
- Font Style
- Font Weight
- Font Variant Numeric
- Letter Spacing
- Line Clamp
- Line Height
- List Style Image
- List Style Position
- List Style Type
- Text Align
- Text Color
- Text Decoration
- Text Decoration Color
- Text Decoration Style
- Text Decoration Thickness
- Text Underline Offset
- Text Transform
- Text Overflow
- Text Wrap
- Text Indent
- Vertical Align
- Whitespace
- Word Break
- Hyphens
- Content
- 背景
- 边框
- Effects
- Filters
- 表格 Tables
- Transitions & Animation
- Transforms
- Interactivity
- SVG
- Accessibility
- 其他
- Install Tailwind CSS using PostCSS
- Framework Guides
- Try Tailwind CSS using the Play CDN
- Install Tailwind CSS with Next.js
- Install Tailwind CSS with Laravel
- Install Tailwind CSS with Vite
- Install Tailwind CSS with Nuxt
- Install Tailwind CSS with Gatsby
- Install Tailwind CSS with SolidJS
- Install Tailwind CSS with SvelteKit
- Install Tailwind CSS with Angular
- Install Tailwind CSS with Ruby on Rails
- Install Tailwind CSS with Remix
- Install Tailwind CSS with Phoenix
- Install Tailwind CSS with Parcel
- Install Tailwind CSS with Symfony
- Install Tailwind CSS with Meteor
- Install Tailwind CSS with Create React App
- Install Tailwind CSS with Adonis
- Install Tailwind CSS With Ember.js
- Install Tailwind CSS with Astro
- Install Tailwind CSS with Qwik
- Install Tailwind CSS with Rspack
Grid Row Start / End
Utilities for controlling how elements are sized and placed across grid rows.
Quick reference
Class | Properties |
---|---|
row-auto | grid-row: auto; |
row-span-1 | grid-row: span 1 / span 1; |
row-span-2 | grid-row: span 2 / span 2; |
row-span-3 | grid-row: span 3 / span 3; |
row-span-4 | grid-row: span 4 / span 4; |
row-span-5 | grid-row: span 5 / span 5; |
row-span-6 | grid-row: span 6 / span 6; |
row-span-7 | grid-row: span 7 / span 7; |
row-span-8 | grid-row: span 8 / span 8; |
row-span-9 | grid-row: span 9 / span 9; |
row-span-10 | grid-row: span 10 / span 10; |
row-span-11 | grid-row: span 11 / span 11; |
row-span-12 | grid-row: span 12 / span 12; |
row-span-full | grid-row: 1 / -1; |
row-start-1 | grid-row-start: 1; |
row-start-2 | grid-row-start: 2; |
row-start-3 | grid-row-start: 3; |
row-start-4 | grid-row-start: 4; |
row-start-5 | grid-row-start: 5; |
row-start-6 | grid-row-start: 6; |
row-start-7 | grid-row-start: 7; |
row-start-8 | grid-row-start: 8; |
row-start-9 | grid-row-start: 9; |
row-start-10 | grid-row-start: 10; |
row-start-11 | grid-row-start: 11; |
row-start-12 | grid-row-start: 12; |
row-start-13 | grid-row-start: 13; |
row-start-auto | grid-row-start: auto; |
row-end-1 | grid-row-end: 1; |
row-end-2 | grid-row-end: 2; |
row-end-3 | grid-row-end: 3; |
row-end-4 | grid-row-end: 4; |
row-end-5 | grid-row-end: 5; |
row-end-6 | grid-row-end: 6; |
row-end-7 | grid-row-end: 7; |
row-end-8 | grid-row-end: 8; |
row-end-9 | grid-row-end: 9; |
row-end-10 | grid-row-end: 10; |
row-end-11 | grid-row-end: 11; |
row-end-12 | grid-row-end: 12; |
row-end-13 | grid-row-end: 13; |
row-end-auto | grid-row-end: auto; |
Basic usage
Spanning rows
Use the row-span-*
utilities to make an element span n rows.
<div class="grid grid-rows-3 grid-flow-col gap-4">
<div class="row-span-3 ...">01</div>
<div class="col-span-2 ...">02</div>
<div class="row-span-2 col-span-2 ...">03</div>
</div>
Starting and ending lines
Use the row-start-*
and row-end-*
utilities to make an element start or end at the nth grid line. These can also be combined with the row-span-*
utilities to span a specific number of rows.
Note that CSS grid lines start at 1, not 0, so a full-height element in a 3-row grid would start at line 1 and end at line 4.
01 02 03<div class="grid grid-rows-3 grid-flow-col gap-4">
<div class="row-start-2 row-span-2 ...">01</div>
<div class="row-end-3 row-span-2 ...">02</div>
<div class="row-start-1 row-end-4 ...">03</div>
</div>
Applying conditionally
Hover, focus, and other states
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:row-span-4
to only apply the row-span-4
utility on hover.
<div class="row-span-3 hover:row-span-4">
<!-- ... -->
</div>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
Breakpoints and media queries
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:row-span-4
to apply the row-span-4
utility at only medium screen sizes and above.
<div class="row-span-3 md:row-span-4">
<!-- ... -->
</div>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.
Using custom values
Customizing your theme
By default, Tailwind includes grid-row utilities for working with grids with up to 6 explicit rows. You can customize these values by editing theme.gridRow
, theme.extend.gridRow
, theme.gridRowStart
, theme.extend.gridRowStart
, theme.gridRowEnd
, and theme.extend.gridRowEnd
in your tailwind.config.js
file.
To add new row-*
utilities, customize the gridRow
section of your Tailwind theme config:
module.exports = {
theme: {
extend: {
gridRow: {
'span-16': 'span 16 / span 16',
}
}
}
}
We use this internally for our row-span-*
utilities. Note that since this configures the grid-row
shorthand property directly, we include the word span
directly in the value name, it’s not baked into the class name automatically. That means you are free to add entries that do whatever you want here — they don’t just have to be span
utilities.
To add new row-start-*
utilities, customize the gridRowStart
section of your Tailwind theme config:
module.exports = {
theme: {
extend: {
gridRowStart: {
'8': '8',
'9': '9',
'10': '10',
'11': '11',
'12': '12',
'13': '13',
}
}
}
}
To add new row-end-*
utilities, customize the gridRowEnd
section of your Tailwind theme config:
module.exports = {
theme: {
extend: {
gridRowEnd: {
'8': '8',
'9': '9',
'10': '10',
'11': '11',
'12': '12',
'13': '13',
}
}
}
}
Learn more about customizing the default theme in the theme customization documentation.
Arbitrary values
If you need to use a one-off grid row value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.
<div class="row-[span_16_/_span_16]">
<!-- ... -->
</div>
Learn more about arbitrary value support in the arbitrary values documentation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论