简体   繁体   English

如何将全屏应用于图像

[英]How to apply full-screen to image

This Gumby's example site : http://tiltingpoint.com/#/ 这个Gumby的示例网站: http : //tiltingpoint.com/#/

can control top red image when we change browser width and height. 更改浏览器的宽度和高度时,可以控制顶部的红色图像。

I think it is done by the "full-screen" in the article tag. 我认为这是通过文章标记中的“全屏显示”完成的。

<article id="panel-1" 
         class="panel" 
         full-screen="" 
         style="background-image:url("http://tiltingpoint.com/images/backgrounds/bg_panel_1.jpg");>

When we changed browwer height, this source was added height style. 当我们更改浏览器高度时,此源添加了高度样式。 I understood it. 我明白了。

But I can't understand any more how does it work and can't find specific description. 但是我再也无法理解它是如何工作的,也找不到具体的描述。

Please tell me how to change image keep aspect according to changing browser width and height. 请告诉我如何根据更改的浏览器宽度和高度更改图像保持外观。

its handy, try this : 它很方便,试试这个:

@media screen and (max-width: 1700px) {

    {
          background: url(newImage.jpg) no-repeat center center fixed; 
    }

}

and this will also work on IE9 这也适用于IE9

/* background setup */
.background {
    background-repeat:no-repeat;
    /* custom background-position */
    background-position:50% 50%;
    /* ie8- graceful degradation */
    background-position:50% 50%9 !important;
}

The only thing I can say is try adding this your css. 我唯一能说的就是尝试将其添加到您的CSS中。 This should make the image expand the full size of its container or parent element. 这应该使图像扩展其容器或父元素的完整大小。

panel-1 {
   width: 100%;
   height: 100%;
}

If that does not work you can do the same 如果那行不通,您可以这样做

panel-1 {
  max-height: 100%;
  max-width: 100%;

These will work based on the size of the parent element. 这些将根据父元素的大小工作。 If you are trying to have it as a BG image I would try inserting into the html element or body element so it is not limited by a parent element that is small. 如果您尝试将其作为BG图像,则尝试插入html元素或body元素,以使其不受较小的父元素的限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM