English 中文(简体)
全面筛选背景形象(缺乏)——不种植?
原标题:full screen background image (sort of) - without cropping?

我的客户想要的是事实上可能无法做的事——他们想要一个完整的背景形象,这种形象是 crop的,并且保持了它的层面。 他们愿意接受白色空间,但希望图像能够最佳地填充任何轴心。 我找到了能真正实现全页背景的冰帽,但是,他们赢得了任何图像的 crop。 任何想法?

问题回答

html:

<img id="bg" src="whateves.jpg"/>

你们可能希望把图像放在 c中。

#bg { display:block; margin:auto; }

使用舱:

$(window).load(function(){
      var windowRezize = function() {
          var windowHeight = $(window).height(),
              bg = $( #bg ),
              bgHeight = bg.height();

            console.log(windowHeight);
            console.log (bgHeight);
          bg.height($(window).height());
          bg.css( opacity ,  1 );
      };
      windowRezize();
      $(window).resize(function(){
          console.log( resized );
          windowRezize();
      })

  });

这并非不可能! 你可以完全这样做。 利用JQuery找到浏览器和voila的高度和宽度! 树立这种规模的背景形象。 如果你需要保持这一方面,则使用“JQuery算法”来计算出的宽度/运费,则使用这一比率来对照实际尺寸的比例基准,如果高/低级将背景图像的高度/宽度定为100%,则以实际比率计算的任何其他方面。

If your client doesn t care about scroll bars you can follow this guide under the third attempt: http://css-tricks.com/766-how-to-resizeable-background-image/ And set the minimum height of the html/body element to whatever it needs to be according to the width of the background image. I hope this all helps you get ideas for what to do.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签