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

为什么用背景做边框,而不直接使用border呢? #41

Closed
xuxchao opened this issue Mar 21, 2019 · 2 comments
Closed

为什么用背景做边框,而不直接使用border呢? #41

xuxchao opened this issue Mar 21, 2019 · 2 comments

Comments

@xuxchao
Copy link

xuxchao commented Mar 21, 2019

background: linear-gradient(rgba($dark-color, .5), rgba($dark-color, .5)) bottom, linear-gradient(rgba($dark-color, .5), rgba($dark-color, .5)) top; background-size: 100% 1px; background-repeat: no-repeat;

我看到 nut-cell-border.scss 文件中有如上代码。用 border 也可以实现为啥这里用了看起来比较麻烦的背景做的边框呢?

@xuxchao xuxchao changed the title 为什么用背景左边框,而不直接使用border呢? 为什么用背景做边框,而不直接使用border呢? Mar 21, 2019
@Franslee
Copy link

这种方式比border更灵活,比如可以轻松实现高分屏1物理像素效果(如果需要的话):
background-image: linear-gradient(rgba($dark-color, .5) 0%, rgba($dark-color, .5) 50%, transparent 50%,transparent 100%);

@xuxchao
Copy link
Author

xuxchao commented Mar 21, 2019

搜噶搜噶,受教了!

@xuxchao xuxchao closed this as completed Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants