gpt4 book ai didi

html - 显示 : flex from display: none in breakpoint not working in safari on OSX

转载 作者:行者123 更新时间:2023-11-28 00:24:55 25 4
gpt4 key购买 nike

给定以下 HTML 和 CSS,myLinks div 在 1025 像素以下的屏幕上隐藏,并在 1025 像素以上的屏幕上显示为 flexbox。该 div 在 Safari 中保持隐藏状态。

#myLinks {
display: none;
}

.menu-link {
padding-top: 0.5em;
}

@media only screen and (min-width: 1025px) {
#myLinks {
background-color: transparent;
display: -webkit-flex;
display: flex;
flex-direction: column;
position: fixed;
width: 300px;
top: 10%;
right: 0;
height: 85vh;
max-height: 85%;
border-radius: 10px;
}
}
<div id="myLinks" class="menu-link"></div>

真正奇怪的是我只是注意到页面上有元素,但没有被渲染。我可以点击它们,但我看不到它们。将 z-index 更改为 999 无法解决问题

编辑:这是一个完全构建的示例,我认为没有任何子项导致 #myLinks 被隐藏,因为从 #myLinks 中删除的 .menu-card 元素显示并正常工作,但也许这里的某些内容没有玩好 myLinks 中的某些东西...

全页运行

#myLinks {
display: none;
}

.menu-link {
padding-top: 0.5em;
}

.menu-card {
display: block;
text-align: center;
padding-bottom: 0;
margin-left: 5%;
margin-right: 5%;
margin-bottom: 4%;
}

.card-text {
text-align: center;
font-size: 0.75em;
padding: 0;
margin: 0;
line-height: 1;
}

/*Style navigation menu images*/
.menu-icon {
display: block;
max-width: 15%;
vertical-align: middle;
margin: auto;
}

/* Style navigation menu links */
#myLinks a {
display: block;
color: white;
font-size: 1.4rem;
text-shadow: 2px 2px black;
text-decoration: none;
text-align: center;
margin-top: 0;
padding: 14px 16px;
padding-top: 0;
}

@media only screen and (min-width: 1025px) {
#myLinks {
background-color: transparent;
display: -webkit-flex;
display: flex;
flex-direction: column;
position: fixed;
width: 300px;
top: 10%;
right: 0;
height: 85vh;
max-height: 85%;
border-radius: 10px;
}

.menu-card a {
position: relative;
width: 100%;
}

.menu-icon {
position: absolute;
z-index: 1;
right: 20%;
max-height: 55%;
border-radius: 50%;
background-color: rgb(148, 181, 201);
background-color: rgba(148, 181, 201, 0.9);
transition: all 0.8s;
max-width: 100%;
}

.card-text {
display: -webkit-flex;
display: flex;
align-items: center;
width: 0;
top: 6%;
height: 100%;
max-height: 0;
text-align: left;
font-size: 125%;
opacity: 0;
color: #5DCA31;
background-color: transparent;
text-shadow: 2px 2px black;
margin: 0;
border-color: rgb(148, 181, 201);
border-color: rgba(148, 181, 201, 0.9);
border-style: solid;
border-radius: 90px;
transition: all 0.8s;
padding-right: 0;
}

.menu-card:hover {
background-color: transparent;
opacity: 1;
transition: all 0.8s;
}

.menu-card:hover .menu-icon {
right: 5%;
}

.menu-card:hover .card-text {
opacity: 1;
padding-left: 10%;
max-height: 65%;
width: 100%;
border-width: 8px;
box-sizing: border-box;
background-color: rgb(148, 181, 201);
background-color: rgba(148, 181, 201, 0.9);
padding-right: 100px;
padding-top: 10px;
padding-bottom: 10px;
transition: background-color 0.8s, border-width 0.8s, max-width 0.8s;
}
}
<div id="myLinks" class="menu-link">
<div class="menu-card">
<a href="#">
<img class="menu-icon" src="https://nuclearterrortoday.org/img/home.jpg">
<p class="card-text" id="home">Home</p>
</a>
</div>
</div>

最佳答案

尝试使用

@media screen and (min-width: 1025px) {
#myLinks {
/* all the styles */
}
}

或者只是

@media (min-width: 1025px) {
#myLinks {
/* all the styles */
}
}

关键字“only”对旧的用户代理隐藏样式表。希望这对您有所帮助!

关于html - 显示 : flex from display: none in breakpoint not working in safari on OSX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54679255/

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