html - 横幅背景图像屏幕分辨率

标签 html css resolution screen-resolution

我正在创建一个网站,我的临时链接是:http://ryanterpilowski.co.uk/urofoam/

正如您在主横幅中看到的那样,我使用了背景图像,文本淡入。我很满意它在普通桌面屏幕上的外观……但在宽屏 (1600x1200) 向上查看时。 .背景图像被裁剪了你可以在这里看到例子:http://www.infobyip.com/testwebsiteresolution.php?url=http%3A%2F%2Fryanterpilowski.co.uk%2Furofoam%2F&width=1680&height=1050&in_browser=true .

我看不到在我的 CSS 中控制它的位置,有人可以帮忙吗?

最佳答案

这叫做 Responsive Web Development(RWD) .为了使页面响应所有设备,我们需要使用 RWD 的一些基本原理。

您可以使用 CSS3 Media queries您可以在其中定位不同的屏幕尺寸。

例如:

/* Smartphones (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {

/* Styles inside this only work when your device width is between 320px to 480px. Same you can set for other sizes*/


}

有关更多详细信息,请查看此 answer

要使图像具有响应性,只需尝试:

img{ max-width: 100%;}

.your-class-name { 
  background: url(images/yourimage.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

请检查这个Large Background Images and Screen Sizes

关于html - 横幅背景图像屏幕分辨率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31451849/

相关文章:

scale - Openlayers 3-分辨率作为样式函数参数代表什么?

html - 将 uib-tab 标题中的文本居中,同时仍然使整个选项卡可点击?

html - 从同一 servlet 中的文本字段上传图像和信息

PHP MYSQL TWIG 下拉菜单创建

html - 如何使标题标题粘在顶部?

CSS:我可以使用嵌套元素的类来缩小 css 范围吗?

css - 链接在 bootstrap xs 上不起作用

C++ 重载决议

html - 如何使用响应式网页设计为 div id 应用高度百分比

html - 根据屏幕分辨率设置背景图像的问题