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

CSS flex-basis प्रॉपर्टी को एनिमेट करें

CSS flex-basis प्रॉपर्टी (फ्लेक्स आइटम की प्रारंभिक मुख्य आकार) को एनिमेट करने के लिए @keyframes का उपयोग करें।

उदाहरण

<!DOCTYPE html> <html> <head> <style>    .box {       display: flex;       background-color: green;    }    .box > div {       background-color: white;       text-align: center;       line-height: 40px;       font-size: 25px;       width: 100px;       margin: 5px;    }    div {       animation: myanim 4s infinite;    }    @-webkit-keyframes myanim {       50% {          flex-basis: 100px;       }    } </style> </head> <body>    <h1>Quiz</h1>    <div class = "box">       <div>Q1</div>       <div>Q2</div>       <div>Q3</div>       <div style = "flex-basis: 350px">Q4</div>       <div>Q5</div>       <div>Q6</div>       <div>Q7</div>       <div>Q8</div>       <div>Q9</div>    </div> </body> </html>

व्याख्या: सभी फ्लेक्स आइटम्स पर 4 सेकंड की एनिमेशन है। 50% पर flex-basis: 100px हो जाता है, जिससे आइटम्स की प्रारंभिक चौड़ाई बदल जाती है। Q4 का इंलाइन flex-basis: 350px एनिमेशन द्वारा ओवरराइड हो जाता है।

  1. - CSS flex-shrink प्रॉपर्टी पर एनिमेशन करें

    फ्लेक्स-श्रिंक एनिमेशन flex-shrink प्रॉपर्टी पर CSS एनिमेशन लागू करें: उदाहरण <!DOCTYPE html> <html> <head> <style> .mycontainer { display: flex; background-color: orange; } .mycontainer > div { background-color: white; text-align: center;

  1. CSS में चाइल्ड सिलेक्टर्स CSS में चाइल्ड सिलेक्टर्स

    चाइल्ड सिलेक्टर CSS चाइल्ड सिलेक्टर का उपयोग किसी विशेष पैरेंट एलिमेंट के सभी चाइल्ड एलिमेंट्स को सिलेक्ट करने के लिए किया जाता है। सिंटैक्स element > element { /*declarations*/ } उदाहरण 1 <!DOCTYPE html> <html> <head> <style> * { padding: 5px; } article > div { border

  1. CSS में Background Attachment CSS में Background Attachment

    CSS में background-attachment प्रॉपर्टी का उपयोग व्यूपोर्ट के सापेक्ष पेज स्क्रॉल होने पर बैकग्राउंड इमेज की स्थिति निर्दिष्ट करने के लिए किया जाता है। इसके मान scroll, fixed और local हो सकते हैं। सिंटैक्स CSS background-attachment प्रॉपर्टी का सिंटैक्स निम्नलिखित है: Selector {    backgr