← Back to Bootstrap Course | Chapter 5: Components — Buttons & Forms | Lesson 1 of 7

Button के Styles

Buttons हर theme colour के लिए solid और outline styles में आते हैं।

In this page:

  1. Button Styles
Syntax
markup
<button class="btn btn-primary">text</button>
<button class="btn btn-outline-danger">text</button>

Button Styles

.btn plus .btn-primary, .btn-outline-danger, या .btn-link जैसा एक variant add करें। button, a, या input elements इस्तेमाल करें; buttons की तरह act करने वाले links के लिए role="button" add करें। Disabled state buttons पर disabled attribute और links पर .disabled class इस्तेमाल करता है।

Note: Actions के लिए button elements और navigation के लिए a elements इस्तेमाल करें।

उदाहरण: Button styles

markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<div class="container d-flex flex-wrap gap-2">
  <button class="btn btn-primary">Primary</button>
  <button class="btn btn-secondary">Secondary</button>
  <button class="btn btn-success">Success</button>
  <button class="btn btn-outline-danger">Outline danger</button>
  <button class="btn btn-link">Link style</button>
  <button class="btn btn-primary" disabled>Disabled</button>
</div>
</body>
</html>
Live Example
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. base .btn class भूल जाना
  2. actions के लिए a links इस्तेमाल करना
  3. meaning convey करने के लिए सिर्फ colour पर depend करना
चैप्टर सारांश
  • .btn plus एक variant class
  • Outline variants exist करते हैं
  • Attribute या class से Disabled
  • Actions के लिए button इस्तेमाल करें
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.