元件模組化技巧
本篇講解 scss 元件如何模組化過程,以 button 元件為例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| .btn { display: inline-block; vertical-align: middle; padding: 0.375rem 0.75rem; text-align: center; text-decoration: none; font-size: 1rem; line-height: 1.5; user-select: none; color: #000; border-radius: 0.375rem; background-color: transparent; border: 1px solid transparent; }
.btn-primary { color: #fff; background-color: #007bff; border-color: #007bff; }
.btn-lg { padding: 0.5rem 1rem; font-size: 1.25rem; line-height: 1.5; border-radius: 0.3rem; }
|