嗨,我有一张图片叫id=“design”,比例是5500px X 3800px。
我想把设计和全屏放在我的电脑或手机浏览器的中心,并向任何方向滚动,以查看整个设计。我应该用Javascript来完成吗?谢谢
最佳答案
把我在这里写下的所有代码添加到css文件中,然后
将它链接到您希望成为响应的网站html。。
:
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) { /*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 2) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 2) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 1){
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 1) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 1) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (-webkit-min-device-pixel-ratio: 1) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 1) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait)
and (-webkit-min-device-pixel-ratio: 1) {
/*StyleHere{}*/
}
Screen Width = 768px (CSS Pixels)
Screen Height = 1024px (CSS Pixels)
Screen Width = 768px (Actual Pixels)
Screen Height = 1024px (Actual Pixels)
Device-pixel-ratio: 1
@media only screen
and (min-device-width : 375px)
and (max-device-width : 667px) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 375px)
and (max-device-width : 667px)
and (orientation : landscape) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 375px)
and (max-device-width : 667px)
and (orientation : portrait) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 414px)
and (max-device-width : 736px) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 414px)
and (max-device-width : 736px)
and (orientation : landscape) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 414px)
and (max-device-width : 736px)
and (orientation : portrait) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px)
and (orientation : landscape) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 320px)
and (max-device-width : 568px)
and (orientation : portrait) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px)
and (orientation : landscape) {
/*StyleHere{}*/
}
@media only screen /*iphone5*/
and (min-device-width : 320px)
and (max-device-width : 480px)
and (orientation : portrait) {
/*StyleHere{}*/
}
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape)
and (-webkit-min-device-pixel-ratio: 2) {
/*StyleHere{}*/
}
@media only screen and (min-device-width : 604px) and (max-device-width : 966px) and (orientation : portrait) {
/*StyleHere{}*/
}
/* Google Nexus 7 2 (portrait and landscape) */
@media only screen and (min-device-width : 600px) and (max-device-width : 960px) {
/*StyleHere{}*/
}
@media only screen and (min-device-width: 1200px)
and (max-device-width: 1600px)
and (-webkit-device-pixel-ratio: 1.5) {
/*StyleHere{}*/
}
@media only screen and (min-device-width: 1200px)
and (max-device-width: 1920px)
and (-webkit-device-pixel-ratio: 1.5) {
/*StyleHere{}*/
}
@media only screen and (min-device-width: 1600px)
and (max-device-width: 2560px)
and (-webkit-device-pixel-ratio: 1.5) {
/*StyleHere{}*/
}