如何应用特定的样式表取决于屏幕分辨率? [英] How to apply specific stylesheet depends on screen resolution?
本文介绍了如何应用特定的样式表取决于屏幕分辨率?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要html中的脚本,它将标识屏幕分辨率,然后取决于我想为应用程序链接相应的样式表。
如果分辨率在600x400之间,那么我想应用mobile.css,否则正常的web.css。
这是可能吗?如果是,那么如何实现呢?
我没有使用jquery ...我有GWT应用程序,我想将此检查添加到html文件。
头标签
如下:
< head&
< meta name =viewportcontent =width = device-width,initial-scale = 1.0> // add this line in your head
< / head>
用于CSS媒体查询
@media only screen and(max-width:600px){
//这里是你的样式表
}
I want script in html which will identify the screen resolution, and then depends on that I want to link respective stylesheet for the application.
e.g. if the resolution is in between 600x400 then I want to apply mobile.css else normal web.css.
Is it possible? If yes then How to achieve this?
I am not using jquery...I am having GWT application, and I want to add this check to the html file.
解决方案
Now add this line in your
Head tag
as like this
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> // add this line in your head
</head>
Used to CSS Media Queries
@media only screen and (max-width: 600px) {
// here your stylesheet
}
这篇关于如何应用特定的样式表取决于屏幕分辨率?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文