कैसे बनाया जाता है: स्विच बटन
- 上一页 自定义选择框
- अगला पृष्ठ चेकबॉक्स चुनें
सीएसएस कैसे इस्तेमाल करके 'स्विच बटन' (आन/बंद) बनाना सीखें।
कैसे स्विच बदलकर चालू करें
पहला कदम - हैटेंड (HTML) जोड़ें:
/* वर्गाकार स्विच */ <label class="switch"> <input type="checkbox"> <span class="slider"></span> </label> /* गोल स्विच */ <label class="switch"> <input type="checkbox"> <span class="slider round"></span> </label>
दूसरा कदम - सीएसएस जोड़ें:
/* स्विच - स्लाइडर के चारों ओर का फ़ेल्क - बॉक्स */ .switch { position: relative; display: inline-block; width: 60px; height: 34px; } /* डिफ़ॉल्ट HTML चेकबॉक्स को छुपाएं */ .switch input { opacity: 0; width: 0; height: 0; } /* स्लाइडर */ .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; -webkit-transition: .4s; transition: .4s; } .slider:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; -webkit-transition: .4s; transition: .4s; } input:checked + .slider { background-color: #2196F3; } input:focus + .slider { box-shadow: 0 0 1px #2196F3; } input:checked + .slider:before { -webkit-transform: translateX(26px); -ms-transform: translateX(26px); transform: translateX(26px); } /* गोल रॉलर स्लाइडर */ .slider.round { border-radius: 34px; } .slider.round:before { border-radius: 50%; }
- 上一页 自定义选择框
- अगला पृष्ठ चेकबॉक्स चुनें