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

CSS से नेविगेशन बार को वेब पेज के टॉप पर फिक्स करें


नेविगेशन बार को टॉप पर सेट करने के लिए, position: fixed प्रॉपर्टी का उपयोग top प्रॉपर्टी के साथ करें।

टॉप पर रहने वाले मेनू को लागू करने के लिए निम्न कोड चलाकर देखें:

उदाहरण

<!DOCTYPE html> <html>    <head>       <style>          ul {             list-style-type: none;             position: fixed;             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:30px;             margin-top:40px;             background-color:white;          }       </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>          <p>Adding demo text to check fixed menu.</p>       </div>    </body> </html>

  1. - CSS से पेजिनेशन को वेब पेज पर सेंटर (केंद्र) में संरेखित करें

    CSS में पेजिनेशन समूह को पेज पर हॉरिजॉन्टली सेंटर (केंद्र) में संरेखित करने के लिए पैरेंट कंटेनर पर text-align: center और पेजिनेशन कंटेनर पर display: inline-block का उपयोग किया जाता है। उदाहरण नीचे दिए गए उदाहरण में, बाहरी कंटेनर (.demo1) पर text-align: center और आंतरिक पेजिनेशन कंटेनर (.demo) पर d

  1. CSS से फिक्स्ड साइड नेविगेशन मेनू कैसे बनाएं? CSS से फिक्स्ड साइड नेविगेशन मेनू कैसे बनाएं?

    CSS का उपयोग करके फिक्स्ड साइड नेविगेशन मेनू बनाने का कोड निम्नलिखित है:उदाहरण<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>

  1. CSS के साथ ऑन-स्क्रॉल फिक्स्ड नेविगेशन बार कैसे बनाएं CSS के साथ ऑन-स्क्रॉल फिक्स्ड नेविगेशन बार कैसे बनाएं

    परिचय CSS position प्रॉपर्टी को निर्दिष्ट करके, हम CSS का उपयोग करके एक फिक्स्ड नेविगेशन बार बना सकते हैं जो स्क्रॉल पर फिक्स्ड हो जाता है। पोजिशन प्रॉपर्टी सिंटैक्स selector { position: static | relative | absolute | fixed | sticky; } उदाहरण: स्टिकी नेविगेशन बार = sticky) { nav.classLi