ఎలా సృష్టించాలి: రెస్పాన్సివ్ సైడ్బార్
CSS ద్వారా రెస్పాన్సివ్ సైడ్బార్ మెనూ సృష్టించడానికి తెలుసుకోండి.
రెస్పాన్సివ్ సైడ్బార్ నేవిగేషన్ సృష్టించండి
మొదటి చర్య - హైల్టెక్స్ చేయండి హైల్టెక్స్ చేయండి:
/* సైడ్బార్ సమాచారం */ సైడ్బార్ <a class="active" href="#home">Home</a> <a href="#news">న్యూస్</a> <a href="#contact">సంప్రదించండి</a> <a href="#about">గురించి</a> </div> <!-- పేజీ కంటెంట్ --> <div class="content"> .. </div>
రెండవ చర్య - సిఎస్ఎస్ జోడించండి:
/* సైడ్బార్ నేవిగేషన్ మెనూ */ .sidebar { margin: 0; padding: 0; width: 200px; background-color: #f1f1f1; position: fixed; height: 100%; overflow: auto; } /* సైడ్బార్ లింక్స్ */ .sidebar a { display: block; color: black; padding: 16px; text-decoration: none; } /* యాక్టివ్/ప్రస్తుతం లింక్స్ */ .sidebar a.active { background-color: #04AA6D; color: white; } /* మౌస్ హోవర్ స్టైల్స్ ఫర్ లింక్స్ */ .sidebar a:hover:not(.active) { background-color: #555; color: white; } /* పేజీ కంటెంట్ను. మార్జిన్-లెఫ్ట్ అట్రిబ్యూట్ విలువ సైడ్బార్ వైడ్త్ అట్రిబ్యూట్ విలువతో మీటింగ్ చేయాలి. */ div.content { margin-left: 200px; padding: 1px 16px; height: 1000px; } /* స్క్రీన్ వెడిథు 700 పిక్సెల్స్ కంటే తక్కువగా ఉన్నప్పుడు, సైడ్బార్ను టాప్ బార్గా మార్చండి */ @media screen and (max-width: 700px) { .sidebar { width: 100%; height: auto; position: relative; } .sidebar a {float: left;} div.content {margin-left: 0;} } /* స్క్రీన్ వెడిథు 400 పిక్సెల్స్ కంటే తక్కువగా ఉన్నప్పుడు, కాలమ్ను వర్గాలుగా చూపించండి, కాదు అడుగులుగా */ @media screen and (max-width: 400px) { .sidebar a { text-align: center; float: none; } }
相关页面
教程:CSS 导航栏