borders.mdx 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ---
  2. title: Borders
  3. description: Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.
  4. ---
  5. ## Border direction
  6. The following border utilities classes will add border to any side of an element.
  7. ```html example centered separated background="white"
  8. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border">1</div>
  9. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border-top">2</div>
  10. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border-end">3</div>
  11. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border-bottom">4</div>
  12. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border-start">5</div>
  13. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border-x">6</div>
  14. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border-y">7</div>
  15. ```
  16. ```html
  17. <div class="border">1</div>
  18. <div class="border-top">2</div>
  19. <div class="border-end">3</div>
  20. <div class="border-bottom">4</div>
  21. <div class="border-start">5</div>
  22. <div class="border-x">6</div>
  23. <div class="border-y">7</div>
  24. ```
  25. ## Border size
  26. Below are the available border size utilities classes.
  27. ```html example centered separated background="white"
  28. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border-0">1</div>
  29. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border">2</div>
  30. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border-wide">3</div>
  31. ```
  32. ```html
  33. <div class="border-0">1</div>
  34. <div class="border">2</div>
  35. <div class="border-wide">3</div>
  36. ```
  37. ## Remove border
  38. You can remove a border on a single side of an element by using the following border utilities classes.
  39. ```html example centered separated background="white"
  40. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-top-0">1</div>
  41. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-end-0">2</div>
  42. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-bottom-0">3</div>
  43. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-start-0">4</div>
  44. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-x-0">5</div>
  45. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-y-0">6</div>
  46. ```
  47. ```html
  48. <div class="border border-top-0">1</div>
  49. <div class="border border-end-0">2</div>
  50. <div class="border border-bottom-0">3</div>
  51. <div class="border border-start-0">4</div>
  52. <div class="border border-x-0">5</div>
  53. <div class="border border-y-0">6</div>
  54. ```
  55. ## Border color
  56. You can set a border color of any side of an element by adding the following utilities classes below.
  57. ```html example centered separated background="white"
  58. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-primary">1</div>
  59. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-secondary">2</div>
  60. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-success">3</div>
  61. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-warning">4</div>
  62. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-danger">5</div>
  63. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-info">6</div>
  64. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-dark">7</div>
  65. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border border-light">8</div>
  66. ```
  67. ```html
  68. <div class="border border-primary">1</div>
  69. <div class="border border-secondary">2</div>
  70. <div class="border border-success">3</div>
  71. <div class="border border-warning">4</div>
  72. <div class="border border-danger">5</div>
  73. <div class="border border-info">6</div>
  74. <div class="border border-dark">7</div>
  75. <div class="border border-light">8</div>
  76. ```
  77. ## Border radius
  78. You can set a border to any element by using the following utilities classes below.
  79. ```html example centered separated background="white"
  80. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border rounded-0">1</div>
  81. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border rounded">2</div>
  82. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border rounded-1">3</div>
  83. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border rounded-2">4</div>
  84. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border rounded-3">5</div>
  85. <div class="d-flex align-items-center justify-content-center text-muted w-5 h-5 bg-light border rounded-circle">6</div>
  86. ```
  87. ```html
  88. <div class="border rounded-0">1</div>
  89. <div class="border rounded">2</div>
  90. <div class="border rounded-1">3</div>
  91. <div class="border rounded-2">4</div>
  92. <div class="border rounded-3">5</div>
  93. <div class="border rounded-circle">6</div>
  94. ```