gpt4 book ai didi

html - 如何右对齐下拉水平子菜单?

转载 作者:太空宇宙 更新时间:2023-11-04 13:06:56 25 4
gpt4 key购买 nike

这是我目前拥有的: https://jsfiddle.net/pjt69trm/2/

HTML:

<body>
<div class="dropdown">
<button class="dropbtn">Language</button>

<div class="dropdown-content">
<a href="#" id="fr">Français</a>
<a href="#" id="es">Español</a>
<a href="#" id="en">English</a>
</div>
</div>
</body>

CSS:

.dropbtn {
background-color: transparent;
background-image: url("https://www.acadaslate.com/App_Themes/Default/images/glyphicon-triangle-bottom.png");
background-repeat: no-repeat;
background-position: right center;
color: black;
border: none;
cursor: pointer;
white-space: pre;
font-size: 1.5vh;
}

.dropdown {
position: absolute;
display: inline-block;
top: 5%;
right: 50%;
margin: 0 0;
}

.dropdown-content {
display: none;
position: absolute;
background-color: white;
width: 350px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}

.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: inline-block;
float: left;
}

.dropdown-content a:hover {
background-color: #f1f1f1
/* branco mais escuro quando passa o mouse por cima */
}

.dropdown:hover .dropdown-content {
display: inline-block;
}

.dropdown:hover .dropbtn {
/* se quiser que fique de outra cor quando passa o mouse por cima... */
background-color: transparent;
}

这就是我想要得到的:

This is what I'm trying to get. (Click)

我觉得我需要更改我的 CSS 中的一行才能拥有它,但我不知道是什么。 :(

我一直在处搜索,但没有成功。也许有人知道。

最佳答案

简单...添加 margin-left:-284px; 到 .dropdown-content

关于html - 如何右对齐下拉水平子菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39884962/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com