Search results
Dec 6, 2016 · Make sure your background image matches the size of the container (at least in width) and set background-repeat: repeat or repeat-x if only the width is equalized. Then, having something appear x pixels from the right is as simple as background-position: -5px 0px. Using percentages for background-position exhibits special behaviour that is ...
May 17, 2017 · @trav Hello, the 'covering' part is correct. I am transitionning the background-position depending on current 'month'. That is why the background-size actually takes 1200% and moving the position up 100% for each month. The 'transition' need is that users will be able to select manually a month so I need to do a smooth transition. –
Jul 23, 2015 · @SlawaEremkin, the solutions work great if you want to repeat a single image twice to give the illusion of infinite. However, this technique would not work for a background image pattern. I would like the same effect, but with a pattern. The current CSS solution is jerky which is animating the background position via CSS transition. –
Apr 15, 2010 · This would be much easier to center than a background image on the body. Other than that try: background-position: 0 100px;/*use a pixel value that will center it*/ Or I think you can use 50% if you have set your body min-height to 100%. background-repeat:no-repeat; background-position: center center;
Feb 23, 2011 · Once rotated, I'm working with the rotated-image in the background property. div.with-background { background-image: url(/img/rotated-image.png); background-size: contain; background-repeat: no-repeat; background-position: top center; } Good Luck...
May 18, 2011 · 2. If you came here because background-position-<axis> is not working and your problem is nothing to do with incomplete background shorthand properties, double check you're not using the contain sizing property: background-size: contain; This doesn't seem to work in conjunction with background-position-<aixis> on Chrome.
(1) The original question was about scaling based on a browser window size. (2) Elements like div get their own height from their own content, or take available space in a flexbox model.
Feb 27, 2014 · You can't position a background-color property, since that property fills the entire space. Likewise, you can't use background-color with a background image, because that would, basically, replace your background image with the filled background-color, at which point there is no reason to use a background image at all!
Apr 20, 2011 · If you are using modern browser, try background-position: calc(100% - 50px) center; as suggested in another answer too. calc has long way to go as it is logically and mathematically capable to produce much accurate result.
May 2, 2012 · If you can add padding/borders to the block equal to the backgrounds you want to position without overlapping other block, you can use the background-clip & background-origin to position the top and bottom backgrounds over the paddings/borders, and the repeating background over the content/paddings+content.