Navigation 如何使导航中的字体大小在固定时保持不变?

Navigation 如何使导航中的字体大小在固定时保持不变?,navigation,font-size,zooming,Navigation,Font Size,Zooming,在移动网站上,当有人放大页面时,导航文本会变大,并在导航栏上占据更多空间。在桌面上缩放时也会发生同样的事情,但我同意 /* Navigation --------------------------------------------------------------------------------*/ .nav-container-fixed { top: 0; z-index: 100; position: fixed; width: 100%; min-width:100%; }

在移动网站上,当有人放大页面时,导航文本会变大,并在导航栏上占据更多空间。在桌面上缩放时也会发生同样的事情,但我同意

/* Navigation
--------------------------------------------------------------------------------*/
.nav-container-fixed {
top: 0;
z-index: 100;
position: fixed;
width: 100%;
min-width:100%;
}

#nav-wrap .nav-container {
float:right;
right:0em;
text-align:left;
padding-left:0%;
position: fixed;
top:0%;
z-index:300;
background:#242424;
border-bottom: 1px solid #fff;
border-top:60px solid #fff;
margin-top:-18px;
min-width:100%;
max-width:100%;
height:2.9em;
max-height:2.9em;
opacity:0.96;   
}

#nav-wrap .nav-container  ul{
float:right;
list-style:none;
position:relative;
left:0%;
z-index:2;
padding-left:0px;
}

#nav-wrap .nav-container  li{float:left;position:relative;}

#nav-wrap .nav-container a{
text-decoration:none;
font:600 16px 'Josefin Sans', sans-serif,bold;
text-transform:inherit;
margin:10px 20px;
float:left;
color:#fff;
letter-spacing:2px;
text-align:right;
white-space:nowrap;
padding-top:5px;
overflow:hidden;
position:relative;
font-size:relative !important;
}
#nav-wrap .nav-container a:hover{
-webkit-animation-name: spaceboots;
-webkit-animation-duration: 0.8s;
-webkit-transform-origin:50% 50%;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
border-bottom:1px dashed #ff0000;
}
#nav-wrap .nav-container li#active a {
border-bottom:3px solid #5882FA !important;
}
#nav-wrap .nav-container a:active{
padding:2px 2px 0px;
}
#nav-wrap {overflow:hidden}/* hide horizontal scrollbar*/

.

您应该使用媒体查询以不同的分辨率维护不同的字体大小。比如h1

h1 {
  font-size: 2em;
  /* 2x body copy size = 32px */
  line-height: 1.25;
  /* 45px / 36px */
}

@media (min-width: 43.75em) {
  h1 {
    font-size: 2.5em;
    /* 2.5x body copy size = 40px */
    line-height: 1.125;
  }
 }

@media (min-width: 56.25em) {
 h1 {
font-size: 3em;
/* 3x body copy size = 48px */
line-height: 1.05;
/* keep to a multiple of the 20px line height 
and something more appropriate for display headings */
}
}

我找到了解决问题的另一种方法,我使用mate标签来禁用移动设备上的缩放/收缩功能,但是在互联网上找到一个类似的元标签后,我自己重写了这个元标签。我必须确保最小刻度设置为“0”,最大刻度设置为“1”,而不说明初始刻度


有了这个移动设备将自动检测到你的网站的大小+在景观上你的网站变得更加清晰

不确定更改h1是否会对我的导航文本产生任何影响,因为此处指定了我的导航面板文本:#nav wrap.nav container a{文本装饰:无;字体:600 16px'Josefin Sans',Sans serif,粗体;文本转换:继承;边距:10px 20px;浮点:左;颜色:#fff;字母间距:2px;文本对齐:右;空白:nowrap;填充顶部:5px;溢出:隐藏;位置:相对;字体大小:相对!重要;}