刚刚创建了我的商业网站,并开始调试测试。像往常一样,我假设。我的导航,正文和页脚会根据使用的设备进行调整。
我希望有一个简单的方法可以根据设备创建屏幕调整,但我不知道该怎么做。我查找的信息都显示了不同的内容。
有人可以帮我解决如何根据屏幕分辨率调整代码的方法吗? (不同的电脑屏幕,移动设备 - iPhone和三星,平板电脑等)
答案 0 :(得分:1)
<style type="text/css">
/* default styles here for older browsers.
I tend to go for a 600px - 960px width max but using percentages
*/
@media only screen and (min-width:960px){
/* styles for browsers larger than 960px; */
}
@media only screen and (min-width:1440px){
/* styles for browsers larger than 1440px; */
}
@media only screen and (min-width:2000px){
/* for sumo sized (mac) screens */
}
@media only screen and (max-device-width:480px){
/* styles for mobile browsers smaller than 480px; (iPhone) */
}
@media only screen and (device-width:768px){
/* default iPad screens */
}
/* different techniques for iPad screening */
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait) {
/* For portrait layouts only */
}
@media only screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape) {
/* For landscape layouts only */
}
</style>