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

CSS से स्टिकी नेवबार बनाएं


स्टिकी नेवबार बनाने के लिए position: sticky; प्रॉपर्टी का उपयोग करें। स्टिकी नेवबार बनाने के लिए निम्न कोड चलाकर देखें:

उदाहरण

<!DOCTYPE html> <html>    <head>       <style>          ul {             list-style-type: none;             position: sticky;             overflow: hidden;             top: 0;             width: 100%;          }          li {             float: left;             border-right: 1px solid white;          }          li a {             display: block;             padding: 8px;             background-color: orange;          }          li:last-child {             border-right: none;          }          div {             padding:5px;             margin-top:5px;             background-color:white;             height:1000px;          }       </style>    </head>    <body>       <ul>          <li><a href = "#home">Home</a></li>          <li><a href = "#news">News</a></li>          <li><a href = "#contact">Contact</a></li>          <li><a href = "#about">About</a></li>       </ul>       <div>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>          <p>Adding demo text to check fixed menu.</p>       </div>    </body> </html>

  1. CSS से स्टिकी एलिमेंट कैसे बनाएं? CSS से स्टिकी एलिमेंट कैसे बनाएं?

    CSS से स्टिकी एलिमेंट बनाने के लिए, कोड निम्नानुसार है -उदाहरण <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1" /> <style>    body {       font-family: "Segoe UI"

  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, Ge

  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