gpt4 book ai didi

css - 带箭头的配置文件图标下拉工具提示

转载 作者:太空宇宙 更新时间:2023-11-04 08:31:42 26 4
gpt4 key购买 nike

这真是令人沮丧。我正在尝试在我的个人资料头像底部添加下拉工具提示。不幸的是,这似乎无法正常工作。工具提示似乎被部分隐藏了。如何保持工具提示的特定设计,使其直接显示在图标底部,箭头指向图标中间?

body {
background-color: #36a4b0;
}

#shell-header {
display: flex;
height: 46px;
overflow: hidden;
z-index: 3;
opacity: 1;
white-space: nowrap;
}

.logo-wrapper {
padding-left: 56px;
}

@media (max-width: 480px) {
.logo-wrapper {
padding-left: 1rem;
}
}

.title-wrapper {
left: 0;
right: 0;
text-align: right;
flex-grow: 1;
}

.avatar-wrapper {
padding-right: 56px;
position: relative;
}

@media (max-width: 480px) {
.avatar-wrapper {
padding-right: 1rem;
}
}

.logo {
height: 30px;
line-height: 40px;
max-width: 96px;
margin-top: 0.35rem;
}

.log-shellHeaderTitle {
font-size: 20px;
line-height: 36px;
color: #fff;
text-overflow: ellipsis;
text-align: center;
display: block;
white-space: nowrap;
overflow: hidden;
font-weight: inherit;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}

.log-langButton {
padding-right: 40px;
}

@media only screen and (max-width: 480px) {
.log-langButton {
padding-right: 10px;
}
}

#log-LangButtSwitch {
background: transparent;
cursor: pointer;
display: block;
position: relative;
float: left;
width: 40px;
padding: 2px;
margin-top: 0.25rem;
border: 2px solid #fff;
border-radius: 28px;
}

.log-switchHandle {
display: block;
background: #fff;
height: 20px;
width: 20px;
z-index: 9999;
border-radius: 20px;
}

.log-switchLabels {
position: absolute;
top: 5px;
z-index: -1;
width: 100%;
font-family: Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}

.log-switchLabels:before {
content: "EN";
position: absolute;
left: 21px;
font-size: 12px;
}

.log-switchLabels:after {
content: "DE";
position: absolute;
right: 26px;
font-size: 12px;
}

.fa-user-o:before {
font-size: 1.375rem;
color: #fff;
}

.avatar {
text-align: center;
margin-top: 0.35rem;
width: 25px;
}

.log-popover {
visibility: visible;
z-index: 460;
display: block;
overflow: visible;
top: 121px;
left: 375.063px;
bottom: 10px;
transition: opacity 0.2s linear;
color: #333333;
min-width: 100px;
box-sizing: border-box;
outline: none;
max-width: 100%;
max-height: 84px;
min-height: 2rem;
overflow: hidden;
background: #ffffff;
border: none;
box-shadow: 0 0.625rem 1.875rem 0 rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
}

.log-popover a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}

.log-popover a:hover {
background-color: #f0f0f0;
}

.log-popover a:active,
.log-popover a:focus {
background: #e8eff6;
outline: 1px dotted #000000;
outline-offset: -2px;
}

.log-popover:after,
.log-popover:before {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}

.log-popover:after {
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}

.log-popover:before {
border-color: rgba(51, 51, 51, 0);
border-bottom-color: #333333;
border-width: 11px;
margin-left: -11px;
}

.log-toolContainer {
position: absolute;
height: 100%;
width: 100%;
}
<div class="log-container">
<div id="shell-header">
<div class="logo-wrapper">
<img src="https://s-media-cache-ak0.pinimg.com/236x/f7/0a/f6/f70af6169bbe3f8346e64a25d54bafea.jpg" class="logo">
</div>
<div class="title-wrapper">
<div class="log-shellHeaderTitle">Dashboard</div>
</div>
<div class="log-langButton">
<div id="log-LangButtSwitch">
<span class="log-switchHandle"></span>
<span class="log-switchLabels"></span>
</div>
</div>
<div class="avatar-wrapper">
<img class="avatar" src="https://www.talentenportaalhellendoorn.nl/thumbnails/man.png">
<div class="log-toolContainer">
<div class="log-popover">
<a href="#">Profile</a>
<a href="#about">Log out</a>
</div>
</div>
</div>
</div>
</div>

最佳答案

#shell-header 中删除 overflow: hidden; 这样菜单就不会被截断,然后使用定位将菜单的容器放在底部/在父项的左侧,并使用 translateX() 将其偏移其自身宽度的 50% + 头像宽度的 50% 以使其在图标下方居中。

body {
background-color: #36a4b0;
}

#shell-header {
display: flex;
height: 46px;
z-index: 3;
opacity: 1;
white-space: nowrap;
}

.logo-wrapper {
padding-left: 56px;
}

@media (max-width: 480px) {
.logo-wrapper {
padding-left: 1rem;
}
}

.title-wrapper {
left: 0;
right: 0;
text-align: right;
flex-grow: 1;
}

.avatar-wrapper {
padding-right: 56px;
position: relative;
}

@media (max-width: 480px) {
.avatar-wrapper {
padding-right: 1rem;
}
}

.logo {
height: 30px;
line-height: 40px;
max-width: 96px;
margin-top: 0.35rem;
}

.log-shellHeaderTitle {
font-size: 20px;
line-height: 36px;
color: #fff;
text-overflow: ellipsis;
text-align: center;
display: block;
white-space: nowrap;
overflow: hidden;
font-weight: inherit;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}

.log-langButton {
padding-right: 40px;
}

@media only screen and (max-width: 480px) {
.log-langButton {
padding-right: 10px;
}
}

#log-LangButtSwitch {
background: transparent;
cursor: pointer;
display: block;
position: relative;
float: left;
width: 40px;
padding: 2px;
margin-top: 0.25rem;
border: 2px solid #fff;
border-radius: 28px;
}

.log-switchHandle {
display: block;
background: #fff;
height: 20px;
width: 20px;
z-index: 9999;
border-radius: 20px;
}

.log-switchLabels {
position: absolute;
top: 5px;
z-index: -1;
width: 100%;
font-family: Helvetica, sans-serif;
font-weight: bold;
color: #fff;
text-transform: uppercase;
text-shadow: 0 1px rgba(255, 255, 255, 0.5);
}

.log-switchLabels:before {
content: "EN";
position: absolute;
left: 21px;
font-size: 12px;
}

.log-switchLabels:after {
content: "DE";
position: absolute;
right: 26px;
font-size: 12px;
}

.fa-user-o:before {
font-size: 1.375rem;
color: #fff;
}

.avatar {
text-align: center;
margin-top: 0.35rem;
width: 25px;
}

.log-popover {
visibility: visible;
z-index: 460;
display: block;
overflow: visible;
top: 121px;
left: 375.063px;
bottom: 10px;
transition: opacity 0.2s linear;
color: #333333;
min-width: 100px;
box-sizing: border-box;
outline: none;
max-width: 100%;
max-height: 84px;
min-height: 2rem;
overflow: hidden;
background: #ffffff;
border: none;
box-shadow: 0 0.625rem 1.875rem 0 rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.15);
border-radius: 0.25rem;
}

.log-popover a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}

.log-popover a:hover {
background-color: #f0f0f0;
}

.log-popover a:active,
.log-popover a:focus {
background: #e8eff6;
outline: 1px dotted #000000;
outline-offset: -2px;
}

.log-popover:after,
.log-popover:before {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}

.log-popover:after {
border-color: rgba(255, 255, 255, 0);
border-bottom-color: #fff;
border-width: 10px;
margin-left: -10px;
}

.log-popover:before {
border-color: rgba(51, 51, 51, 0);
border-bottom-color: #333333;
border-width: 11px;
margin-left: -11px;
}

.log-toolContainer {
position: absolute;
height: 100%;
width: 100%;
top: 100%;
left: 0;
transform: translateX(calc(-50% + 12.5px));
}
<div class="log-container">
<div id="shell-header">
<div class="logo-wrapper">
<img src="https://s-media-cache-ak0.pinimg.com/236x/f7/0a/f6/f70af6169bbe3f8346e64a25d54bafea.jpg" class="logo">
</div>
<div class="title-wrapper">
<div class="log-shellHeaderTitle">Dashboard</div>
</div>
<div class="log-langButton">
<div id="log-LangButtSwitch">
<span class="log-switchHandle"></span>
<span class="log-switchLabels"></span>
</div>
</div>
<div class="avatar-wrapper">
<img class="avatar" src="https://www.talentenportaalhellendoorn.nl/thumbnails/man.png">
<div class="log-toolContainer">
<div class="log-popover">
<a href="#">Profile</a>
<a href="#about">Log out</a>
</div>
</div>
</div>
</div>
</div>

关于css - 带箭头的配置文件图标下拉工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44738686/

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