safari 的 flexbox 行和列 ul li 菜单
flexbox row and column ul li menu for safari
nav {
font-family: Arial, sans-serif;
border: 1px solid #ccc;
border-right: none;
width: 100%;
}
nav ul {
display: flex;
flex-pack: center
}
nav ul {
margin: 0;
padding: 0;
display: -ms-flexbox;
display: -webkit-flex;
-webkit-flex-flow: row wrap;
-moz-flex-flow: row wrap;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
}
nav ul li {
list-style: none;
text-align: center;
//border-left: 1px solid #fff;
//border-right: 1px solid #ccc;
background-color: #feaa38;
background-image: -webkit-gradient(linear, left top, left bottom, from(#F5F5F5), to(#feaa38));
background-image: -webkit-linear-gradient(top, #F5F5F5, #feaa38);
background-image: -moz-linear-gradient(top, #F5F5F5, #feaa38);
background-image: -o-linear-gradient(top, #F5F5F5, #feaa38);
background-image: linear-gradient(to bottom, #F5F5F5, #feaa38);
position: relative;
-webkit-flex: 1 0 auto;
-moz-flex: 1 0 auto;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
}
nav ul li:hover {
background-color: #feaa38;
}
nav ul li a {
text-decoration: none;
color: #000;
display: block;
padding: 10px 0;
}
nav ul li:hover a {
color: #FFF;
}
nav ul li ul {
display: flex;
}
nav ul li ul {
position:absolute;
top:-999em;
display: -ms-flexbox;
display: -webkit-flex;
-webkit-flex-flow: column wrap;
-moz-flex-flow: column wrap;
-ms-flex-flow: column wrap;
flex-flow: column wrap;
justify-content: space-around;
width:100%;
}
nav ul li:hover > ul{
top: auto;
display: flex;
flex-direction: column;
margin: 0;
padding: 0;
z-index: 9998;
}
nav ul li ul li {
background: #b56906;
}
nav ul li ul li a {
text-decoration: none;
color:#000000 !important;
display: block;
padding: 10px 0;
}
nav ul li ul li ul{
position: absolute;
left: 100%;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
-webkit-flex-flow: column wrap;
-moz-flex-flow: column wrap;
-ms-flex-flow: column wrap;
flex-flow: column wrap;
justify-content: space-around;
width:100%;
}
nav ul li ul li:hover > ul{
top: 0;
display: flex;
flex-direction: column;
margin: 0;
padding: 0;
z-index: 9999;
}
nav ul li:Last-child {
border-right: none;
}
<nav>
<ul>
<li>
adasdasdasda
<ul>
<li>
12321321321
<ul>
<li>
12adas4asfsafds321321321
</li>
<li>
56345sdfdsfdsfdssd453543
</li>
</ul>
</li>
<li>
56345453543
</li>
</ul>
</li>
<li>
fasffasf
</li>
<li>
asdasdas
<ul>
<li>
12321321321
</li>
<li>
56345453543
</li>
</ul>
</li>
</ul>
</nav>
这是我在菜单上 css 的代码我正在添加动态菜单所以我使用弹性框使宽度统一即使我添加动态菜单子菜单和另一个子菜单问题是当我尝试它在 sarafi 上没有为 chrome 做 ok.But 即和 mozilla 没问题。 safari 似乎有什么不同,它不起作用
我刚刚将我的导航栏更改为这个并且它起作用了
nav ul {
margin: 0;
padding: 0;
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: box;
display: flex;
-webkit-box-lines: multiple;
-moz-box-lines: multiple;
-o-box-lines: multiple;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-o-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
}
nav {
font-family: Arial, sans-serif;
border: 1px solid #ccc;
border-right: none;
width: 100%;
}
nav ul {
display: flex;
flex-pack: center
}
nav ul {
margin: 0;
padding: 0;
display: -ms-flexbox;
display: -webkit-flex;
-webkit-flex-flow: row wrap;
-moz-flex-flow: row wrap;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
}
nav ul li {
list-style: none;
text-align: center;
//border-left: 1px solid #fff;
//border-right: 1px solid #ccc;
background-color: #feaa38;
background-image: -webkit-gradient(linear, left top, left bottom, from(#F5F5F5), to(#feaa38));
background-image: -webkit-linear-gradient(top, #F5F5F5, #feaa38);
background-image: -moz-linear-gradient(top, #F5F5F5, #feaa38);
background-image: -o-linear-gradient(top, #F5F5F5, #feaa38);
background-image: linear-gradient(to bottom, #F5F5F5, #feaa38);
position: relative;
-webkit-flex: 1 0 auto;
-moz-flex: 1 0 auto;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
}
nav ul li:hover {
background-color: #feaa38;
}
nav ul li a {
text-decoration: none;
color: #000;
display: block;
padding: 10px 0;
}
nav ul li:hover a {
color: #FFF;
}
nav ul li ul {
display: flex;
}
nav ul li ul {
position:absolute;
top:-999em;
display: -ms-flexbox;
display: -webkit-flex;
-webkit-flex-flow: column wrap;
-moz-flex-flow: column wrap;
-ms-flex-flow: column wrap;
flex-flow: column wrap;
justify-content: space-around;
width:100%;
}
nav ul li:hover > ul{
top: auto;
display: flex;
flex-direction: column;
margin: 0;
padding: 0;
z-index: 9998;
}
nav ul li ul li {
background: #b56906;
}
nav ul li ul li a {
text-decoration: none;
color:#000000 !important;
display: block;
padding: 10px 0;
}
nav ul li ul li ul{
position: absolute;
left: 100%;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
-webkit-flex-flow: column wrap;
-moz-flex-flow: column wrap;
-ms-flex-flow: column wrap;
flex-flow: column wrap;
justify-content: space-around;
width:100%;
}
nav ul li ul li:hover > ul{
top: 0;
display: flex;
flex-direction: column;
margin: 0;
padding: 0;
z-index: 9999;
}
nav ul li:Last-child {
border-right: none;
}
<nav>
<ul>
<li>
adasdasdasda
<ul>
<li>
12321321321
<ul>
<li>
12adas4asfsafds321321321
</li>
<li>
56345sdfdsfdsfdssd453543
</li>
</ul>
</li>
<li>
56345453543
</li>
</ul>
</li>
<li>
fasffasf
</li>
<li>
asdasdas
<ul>
<li>
12321321321
</li>
<li>
56345453543
</li>
</ul>
</li>
</ul>
</nav>
这是我在菜单上 css 的代码我正在添加动态菜单所以我使用弹性框使宽度统一即使我添加动态菜单子菜单和另一个子菜单问题是当我尝试它在 sarafi 上没有为 chrome 做 ok.But 即和 mozilla 没问题。 safari 似乎有什么不同,它不起作用
我刚刚将我的导航栏更改为这个并且它起作用了
nav ul {
margin: 0;
padding: 0;
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: box;
display: flex;
-webkit-box-lines: multiple;
-moz-box-lines: multiple;
-o-box-lines: multiple;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-o-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
}