我希望在浏览器中调整大小以及移动我的字体大小改变。如果我尝试做它在PC此代码的工作,但如果我打开我的网站在移动设备上不调整我的文字。如何设置媒体查询,并使其工作在移动
我问为什么这个代码不工作,没怎么写。
HTML(关于样式表;一个为移动是 “handheld.css”):
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css" media="only screen and (min-width: 1121px)">
<link rel="stylesheet" type="text/css" href="handheld.css" media="only screen and (max-width:1120px)">
handheld.css:
@media only screen and (max-width:320px) {
#easy {
font-size: 24px;
}
h2{
font-size: 15px;
}
}
@media only screen and (min-width:321px) {
#easy {
font-size: 25px;
}
h2{
font-size: 16px;
}
}
@media only screen and (min-width:380px) {
#easy {
font-size: 26px;
}
h2{
font-size: 17px;
}
}
@media only screen and (min-width:420px) {
#easy {
font-size: 27px;
}
h2{
font-size: 18px;
}
}
#easy{
position: relative;
left: 40%;
font-family: "sweetness", Verdana;
top: -63%;
margin-left: 3px;
fontsize: calc(15px + 3vw);\\this is an alternative to media queries
}
h2{
position: relative;
color:#fff;
text-decoration: none;
font-family: "sweetness", Verdana;
text-shadow:
-0.5px -0.5px 0 #000,
0.5px -0.5px 0 #000,
-0.5px 0.5px 0 #000,
0.5px 0.5px 0 #000;
top: 40px;
fontsize: calc(15px + 2vw); \\this is an alternative to media queries
}
[媒体查询?如何针对台式机,平板电脑和移动]的可能的复制(http://stackoverflow.com/questions/6370690/media-queries-how -to-目标桌面平板电脑和移动设备) –
@n_palum我写的代码无法正常工作,而不是如何做到这一点! –
@NiccolòGuidi:这只是一个例子吗?它没有意义的1px的递增字体大小... – deblocker