【发布时间】:2015-08-15 09:59:46
【问题描述】:
我正在使用 Zurbs 响应式框架基础。
我决定希望顶部栏在更大的屏幕上变成一个汉堡图标,因为我有很多菜单选项,当在平板电脑等中等大小的屏幕上查看网站时,它们会向下推到两行。
所以我找到了正在确定大小的媒体查询
@media only screen and (min-width: 40rem) {...}
我将其更改为 1025 像素,现在它显示在 1025 像素或更小的屏幕上。问题是实际菜单在较小的屏幕上打开并变大时不会打开或保持打开状态。
我认为这与在某处设置的最大宽度有关,但我在该媒体查询中找到的最大宽度并没有改变任何东西。
这是整个查询
@media only screen and (min-width: 1024px) {
.top-bar {
background: #333333;
overflow: visible; }
.top-bar:before, .top-bar:after {
content: " ";
display: table; }
.top-bar:after {
clear: both; }
.top-bar .toggle-topbar {
display: none; }
.top-bar .title-area {
float: left; }
.top-bar .name h1 a {
width: auto; }
.top-bar input,
.top-bar .button,
.top-bar button {
font-size: 0.875rem;
position: relative;
height: 1.75rem;
top: 0.53125rem; }
.top-bar.expanded {
background: #333333; }
.contain-to-grid .top-bar {
/*max-width: 62.5rem;*/
margin: 0 auto;
margin-bottom: 0; }
.top-bar-section {
transition: none 0 0;
left: 0 !important; }
.top-bar-section ul {
width: auto;
height: auto !important;
display: inline; }
.top-bar-section ul li {
float: left; }
.top-bar-section ul li .js-generated {
display: none; }
.top-bar-section li.hover > a:not(.button) {
background-color: #555555;
background: #333333;
color: #FFFFFF; }
.top-bar-section li:not(.has-form) a:not(.button) {
padding: 0 0.9375rem;
line-height: 2.8125rem;
background: #f68c3b; }
.top-bar-section li:not(.has-form) a:not(.button):hover {
background-color: #555555;
background: pink; }
.top-bar-section li.active:not(.has-form) a:not(.button) {
padding: 0 0.9375rem;
line-height: 2.8125rem;
color: #FFFFFF;
background: #008CBA; }
.top-bar-section li.active:not(.has-form) a:not(.button):hover {
background: #0078a0;
color: #FFFFFF; }
.top-bar-section .has-dropdown > a {
padding-right: 2.1875rem !important; }
.top-bar-section .has-dropdown > a:after {
content: "";
display: block;
width: 0;
height: 0;
border: inset 5px;
border-color: rgba(255, 255, 255, 0.4) transparent transparent transparent;
border-top-style: solid;
margin-top: -2.5px;
top: 1.40625rem; }
.top-bar-section .has-dropdown.moved {
position: relative; }
.top-bar-section .has-dropdown.moved > .dropdown {
display: block;
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
clip: rect(1px, 1px, 1px, 1px); }
.top-bar-section .has-dropdown.hover > .dropdown, .top-bar-section .has-dropdown.not-click:hover > .dropdown {
display: block;
position: static !important;
height: auto;
width: auto;
overflow: visible;
clip: auto;
position: absolute !important; }
.top-bar-section .has-dropdown > a:focus + .dropdown {
display: block;
position: static !important;
height: auto;
width: auto;
overflow: visible;
clip: auto;
position: absolute !important; }
.top-bar-section .has-dropdown .dropdown li.has-dropdown > a:after {
border: none;
content: "\00bb";
top: 1rem;
margin-top: -1px;
right: 5px;
line-height: 1.2; }
.top-bar-section .dropdown {
left: 0;
top: auto;
background: transparent;
min-width: 100%; }
.top-bar-section .dropdown li a {
color: #FFFFFF;
line-height: 2.8125rem;
white-space: nowrap;
padding: 12px 0.9375rem;
background: #333333; }
.top-bar-section .dropdown li:not(.has-form):not(.active) > a:not(.button) {
color: #FFFFFF;
background: #333333; }
.top-bar-section .dropdown li:not(.has-form):not(.active):hover > a:not(.button) {
color: #FFFFFF;
background-color: #555555;
background: #333333; }
.top-bar-section .dropdown li label {
white-space: nowrap;
background: #333333; }
.top-bar-section .dropdown li .dropdown {
left: 100%;
top: 0; }
.top-bar-section > ul > .divider, .top-bar-section > ul > [role="separator"] {
border-bottom: none;
border-top: none;
border-right: solid 1px #4e4e4e;
clear: none;
height: 2.8125rem;
width: 0; }
.top-bar-section .has-form {
background: #333333;
padding: 0 0.9375rem;
height: 2.8125rem; }
.top-bar-section .right li .dropdown {
left: auto;
right: 0; }
.top-bar-section .right li .dropdown li .dropdown {
right: 100%; }
.top-bar-section .left li .dropdown {
right: auto;
left: 0; }
.top-bar-section .left li .dropdown li .dropdown {
left: 100%; }
.no-js .top-bar-section ul li:hover > a {
background-color: #555555;
background: #333333;
color: #FFFFFF; }
.no-js .top-bar-section ul li:active > a {
background: #008CBA;
color: #FFFFFF; }
.no-js .top-bar-section .has-dropdown:hover > .dropdown {
display: block;
position: static !important;
height: auto;
width: auto;
overflow: visible;
clip: auto;
position: absolute !important; }
.no-js .top-bar-section .has-dropdown > a:focus + .dropdown {
display: block;
position: static !important;
height: auto;
width: auto;
overflow: visible;
clip: auto;
position: absolute !important; } }
【问题讨论】:
标签: css zurb-foundation