HI
i have made this menu whit the HTML model
but can some tell me why i cant make it position:sticky;?
<div class=“alphabet-menu-container”>
<ul class=“alphabet-menu”>
<li><a href=“a”>A</a></li>
<li><a href=“b”>B</a></li>
<li><a href=“c”>C</a></li>
<li><a href=“d”>D</a></li>
<li><a href=“e”>E</a></li>
<li><a href=“#f”>F</a></li>
<li><a href=“#g”>G</a></li>
<li><a href=“h”>H</a></li>
<li><a href=“i”>I</a></li>
<li><a href=“#j”>J</a></li>
<li><a href=“#k”>K</a></li>
<li><a href=“l”>L</a></li>
<li><a href=“m”>M</a></li>
<li><a href=“n”>N</a></li>
<li><a href=“#o”>O</a></li>
<li><a href=“#p”>P</a></li>
<li><a href=“#q”>Q</a></li>
<li><a href=“#r”>R</a></li>
<li><a href=“s”>S</a></li>
<li><a href=“t”>T</a></li>
<li><a href=“#u”>U</a></li>
<li><a href=“#v”>V</a></li>
<li><a href=“#w”>W</a></li>
<li><a href=“#x”>X</a></li>
<li><a href=“#y”>Y</a></li>
<li><a href=“z”>Z</a></li>
<li><a href=“#ae”>Æ</a></li>
<li><a href=“#oe”>Ø</a></li>
<li><a href=“#aa”>Å</a></li>
</ul>
</div>
<style>
.alphabet-menu a {
color: #333;
text-decoration: none;
font-weight: bold;
padding: 6px 12px;
margin-right: 8px;
border-radius: 6px;
transition: all 0.2s ease;
}
.alphabet-menu a:last-child {
margin-right: 0;
}
.alphabet-menu-container {
position:sticky;
display: flex;
align-items: center;
justify-content: center;
background-color: #ffffff;
border-radius: 8px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
padding: 12px;
margin-bottom: 50px;
top: 20px;
z-index: 1;
}
.alphabet-menu {
display: flex;
justify-content: center;
align-items: center;
list-style: none;
margin: 0;
padding: 0;
font-size: 16px;
}
.alphabet-menu li {
margin: 0;
}
.alphabet-menu a {
color: #333;
text-decoration: none;
font-weight: bold;
padding: 10px 10px;
margin-right: 0px;
margin-left: 0px;
border-radius: 1px;
transition: all 0.2s ease;
}
.alphabet-menu a:last-child {
margin-right: 0;
}
.alphabet-menu a:hover {
background-color: #ff6600;
color: #ffffff;
}
hs_cos_wrapper_type_rich_text ul, .hs_cos_wrapper_type_rich_text ol, .faktaboks ul, .faktaboks ol, .submitted-message ul, .submitted-message ul, .widget-type-custom_widget.dnd-module ul {
padding-left: 0px;!important
}
</style>
I just tested your code and it seems to be working.
You probably have some more CSS somewhere else which is causing issues.
https://www.relevans.dk/ordbog-index
ty,
i dono why it dont work
i dont know if you can help but when on mobil its stats on “I”
code i did use:
@media (max-width: 768px) {
.alphabet-menu {
display: flex;
justify-content: center;
align-items: center;
list-style: none;
margin: 0;
padding: 0;
font-size: 16px;
white-space: nowrap;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: none;
scrollbar-width: none;
}
.alphabet-menu::-webkit-scrollbar {
display: none;
}
.alphabet-menu a {
color: #ffff;
text-decoration: none;
font-weight: bold;
padding: 10px 10px;
margin-right: 0px;
margin-left: 0px;
border-radius: 1px;
transition: all 0.3s ease;
display: inline-block;
}
.alphabet-menu a:last-child {
margin-right: 0;
}
.alphabet-menu a:hover {
background-color: #ffff;
color: #333;
}
.alphabet-menu-container {
position: sticky;
top: 20px;
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
background-color: #ff6600;
border-radius: 2px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
padding: 12px;
margin-bottom: 50px;
transition: all 0.3s ease;
}
.alphabet-menu-container.fixed {
position: fixed;
top: 0;
left: 0;
width: 100%;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
animation: slide-down 0.3s ease;
}
@keyframes slide-down {
from {
transform: translateY(-100%);
}
to {
transform: translateY(0%);
}
}}
https://www.relevans.dk/ordbog-index
ty,
i dono why it dont work
i dont know if you can help but when on mobil its stats on “I”
code i did use:
@media (max-width: 768px) {
.alphabet-menu {
display: flex;
justify-content: center;
align-items: center;
list-style: none;
margin: 0;
padding: 0;
font-size: 16px;
white-space: nowrap;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
-ms-overflow-style: none;
scrollbar-width: none;
}
.alphabet-menu::-webkit-scrollbar {
display: none;
}
.alphabet-menu a {
color: #ffff;
text-decoration: none;
font-weight: bold;
padding: 10px 10px;
margin-right: 0px;
margin-left: 0px;
border-radius: 1px;
transition: all 0.3s ease;
display: inline-block;
}
.alphabet-menu a:last-child {
margin-right: 0;
}
.alphabet-menu a:hover {
background-color: #ffff;
color: #333;
}
.alphabet-menu-container {
position: sticky;
top: 20px;
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
background-color: #ff6600;
border-radius: 2px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
padding: 12px;
margin-bottom: 50px;
transition: all 0.3s ease;
}
.alphabet-menu-container.fixed {
position: fixed;
top: 0;
left: 0;
width: 100%;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1);
animation: slide-down 0.3s ease;
}
@keyframes slide-down {
from {
transform: translateY(-100%);
}
to {
transform: translateY(0%);
}
}}