Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS Layout 问题 #43

Open
gnosis23 opened this issue Apr 30, 2019 · 1 comment
Open

CSS Layout 问题 #43

gnosis23 opened this issue Apr 30, 2019 · 1 comment
Labels

Comments

@gnosis23
Copy link
Owner

Flex

情况一

怎么解决最后一行的问题...
aaaa

@gnosis23
Copy link
Owner Author

gnosis23 commented Apr 30, 2019

Grid Layout

grid-template-columns

grid-template-columns 可以设定固定的值,也可以设置百分比

// 横向 2 个 200px
grid-template-columns: 200px 200px;

用下面这段代码可以解决上面的问题:repeat表示重复,而 auto-fill 值表示能撑满容器的最大个数。

.parent {
  display: grid;
  grid-template-columns: repeat(auto-fill, 220px); 
  grid-gap: 1rem; 
  justify-content: space-between; 
}

@gnosis23 gnosis23 added the CSS label Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant