borders.mdx 5.7 KB

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