Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> CSS

CSS से वर्टिकल बटन ग्रुप बनाएं

वर्टिकल (लंबवत) बटन ग्रुप बनाने के लिए बटन्स को display: block दें और उन्हें एक कंटेनर में रखें। प्रत्येक बटन नई लाइन पर दिखाई देगा।

उदाहरण: वर्टिकल बटन ग्रुप

<!DOCTYPE html>
<html>
<head>
  <style>
    .vertical-btn-group {
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-width: 200px;
    }
    .vertical-btn-group button {
      background-color: orange;
      border: 1px solid green;
      color: white;
      font-size: 14px;
      padding: 10px;
      text-align: center;
      text-decoration: none;
      cursor: pointer;
      border-radius: 4px;
      transition: background-color 0.3s;
    }
    .vertical-btn-group button:hover {
      background-color: darkorange;
    }
  </style>
</head>
<body>
  <div class="vertical-btn-group">
    <button class="button">रिज़ल्ट 1</button>
    <button class="button">रिज़ल्ट 2</button>
    <button class="button">रिज़ल्ट 3</button>
    <button class="button">रिज़ल्ट 4</button>
  </div>
</body>
</html>

मॉडर्न दृष्टिकोण (Flexbox)

पुराने float या display: block के बजाय Flexbox का उपयोग करें:

.btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;  /* बटन्स के बीच स्पेस */
}

हॉरिजॉन्टल ग्रुप के लिए

.btn-group-horizontal {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

बॉर्डर रेडियस टिप

ग्रुप के पहले और अंतिम बटन के लिए अलग-अलग बॉर्डर रेडियस:

.btn-group button:first-child { border-radius: 4px 4px 0 0; }
.btn-group button:last-child { border-radius: 0 0 4px 4px; }
.btn-group button:not(:first-child):not(:last-child) { border-radius: 0; }
  1. CSS से बेसिक कार्ड कैसे बनाएं? CSS से बेसिक कार्ड कैसे बनाएं?

    बेसिक कार्ड में इमेज, नाम, पदनाम होता है। बॉक्स-शैडो, होवर पर शैडो गहरी, पदनाम बैज स्टाइल, रिस्पॉन्सिव चौड़ाई (40%, मैक्स 300px)। उदाहरण <!DOCTYPE html> <html> <head> <meta name=viewport content=width=device-width, initial-scale=1> <style> body { font-family:

  1. CSS से कूपन बनाना CSS से कूपन बनाना

    कूपन डिज़ाइन CSS से कूपन बनाने के लिए निम्न कोड उपयोग करें: उदाहरण <!DOCTYPE html> <html> <head> <meta name=viewport content=width=device-width, initial-scale=1 /> <style> body { font-family: Segoe UI, Tahoma, Geneva, Verdana, sans-serif; } img { width: 100%; } .coupon

  1. CSS से वर्टिकल लाइन कैसे बनाएं? CSS से वर्टिकल लाइन कैसे बनाएं?

    CSS से वर्टिकल लाइन बनाने के लिए, कोड निम्नानुसार है -उदाहरण<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style>    .vLine {       border-left: 6px solid rgb(128, 0, 128);