Background position seems to be inaccurate

Background position seems to be inaccurate

Content Index :

Background position seems to be inaccurate
Tag : html , By : user92243
Date : November 23 2020, 01:01 AM

I hope this helps . As pointed out by Dharmang, cause of the issue was aspect ratio of image. And, it was not possible to fix, without changing the #wrapper dimension, or the image itself.
I've found a workaround, but using img tag, instead of background-image, so that I can distort the aspect ratio of images of mask div, in equal amount, as it is destroyed by the 'real image'.
$('#switcher').click(function () {
    if ($(this).hasClass('main')) {
        $(this).html('Put mask on top').removeClass('main');
            zIndex: 1
            zIndex: 2
    } else {
        $(this).html('Put main on top').addClass('main')
            zIndex: 2
            zIndex: 1
img {
    width: 100%;
    height: 100%;
#wrapper {
    position: relative;
    width: 390px;
    height: 300px;
#main {
    z-index: 2;
#mask {
    z-index: 1;
#main, #mask, .part {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
.part {
    width: 130px;

.part img {
    margin-left: 0;
    width: 390px;
    height: 300px;

.part2 {
    left: 130px;

.part2 img {
    margin-left: -130px; 

.part3 {
    left: 260px;

.part3 img {
    margin-left: -260px;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div id="wrapper">
    <div id="main">
        <img src="http://images.all-free-download.com/images/graphiclarge/grasshopperpraying_mantis_195444.jpg" />
    <div id="mask">
        <div class="part part1"><img src="http://images.all-free-download.com/images/graphiclarge/grasshopperpraying_mantis_195444.jpg" /></div>
        <div class="part part2"><img src="http://images.all-free-download.com/images/graphiclarge/grasshopperpraying_mantis_195444.jpg" /></div>
        <div class="part part3"><img src="http://images.all-free-download.com/images/graphiclarge/grasshopperpraying_mantis_195444.jpg" /></div>
<button id="switcher" class="main">Put mask on top</button>

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Wildly inaccurate GPS position and velocity

Tag : android , By : David
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further Handheld GPS devices are much less accurate than is typically claimed, but being off by 100 km (or by whatever the distance is between Bolton and Madrid) is pretty spectacularly unusual. It sounds like something weird may have briefly happened to the GPS system.
The other GPS receiver in your car would not have caused this - the device antenna just receives signals, it doesn't broadcast anything.

Inaccurate position().left when using touchmove/mousemove

Tag : javascript , By : PeteFilicetti
Date : March 29 2020, 07:55 AM
it helps some times I didn't need to calculate $panel.position().left on every mouse move so I simply moved this to the top of the function. A work around perhaps but it seems to be fine now: LINK

XSL: position() function and Counting: inaccurate results

Tag : xml , By : user105769
Date : March 29 2020, 07:55 AM
will be helpful for those in need So I have been trying to understand why XPath is not returning correct values when I am inputting what seems to be correct (syntax wise). , When you are in the context of:
<xsl:for-each select="ASNShipmentContainers/ASNShipmentContainer">

C - Inaccurate write() position obtained with lseek() when using multiple threads

Tag : c , By : usingtechnology
Date : March 29 2020, 07:55 AM

Java MouseEvent position is inaccurate

Tag : java , By : user135518
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Why won't the color #e67d22e1 display in Safari?
  • How to select specific tag's attribute value with xPath?
  • How to make div rows fill available height
  • How to fix text inside a block that grows
  • svg hexagon halftone pattern
  • How to edit a website's element's background colors using a chromium extention
  • What is the main tag in HTML5 ? How does it differ from body tag?
  • My image is flowing out from my div column. How I can fix it and made the image full-size into div
  • How to draw line in react
  • Why Transition css is not working in child selector css
  • How to modify materialize css select option?
  • How to center some text in a rectangle in CSS?
  • How do I equally space out css grid columns?
  • How to make sure all the parts of a macro are running correctly?
  • How to adjust the zoom of website at different browser at different screen size?
  • Can't set max height on child div properly
  • Why background color is not applying to DIV container?
  • Need to select the first-child
  • No space between attributes in buttons
  • How can I block google from crawling my page, but still let Baidu do it?
  • Rendering html content in matToolTip (Angular)
  • Embedding an iframe when iframe height is variable
  • How to use 'word-break: break-word' with link inside of text?
  • How I can animate circular progress bar from left to right?
  • Angular 6 - How can I hide a div onclick of outside of that div
  • How to fill an inline-block div with a solid color?
  • Form file doesn't align with rest of form
  • How to trim off left and right sides of image evenly as I reduce my screen size? (@media query)
  • How can I password protect a section of a static website?
  • Move a div up when I hover over it
  • Why is "align" not a valid attribute of div but still works?
  • Behavior with height/minHeight and display:flex
  • How can i change my h2 title to <p> text while keeping size and alignment?
  • Hover on the text to change size using CSS
  • How to keep a grid of cols without breaking on a new row?
  • Why is bottom: 0 not enough to move ::after content directly below main content?
  • Why does a React build need to be served? Why can't I just open it in the browser?
  • What is the proper way to target the tab key 'highlight' events on an html element?
  • How to Implement dot and line below the text in CSS?
  • DIVs not properly aligned
  • HTML 'for' tag not working for <p> but works on <label>
  • <p> element does not appear to be within parent <footer> element
  • Why flex container is smaller than its content
  • Center an image and a text in a div
  • .class with display: none -> .class:focus with display: block; causes links to not work
  • Best way to use a right pointing arrow in CSS animation
  • Angular 7 : Select tag doesn't display options
  • Orientation: Landscape showing true for desktop
  • How to adjust text in a table
  • React Button Click Event Not Firing - One Button Works, One Button Doesnt
  • Angular Material: using mat-sidenav, cannot read property 'toggle' of undefined
  • Share image whatsapp not visible
  • Why does ImageResizer increase the loading time?
  • Can someone help figure out whats wrong with my answer on testdome?
  • Safari Viewport Bug, Issues with Fixed Position and Bottom or Top
  • Why does SVG produce blurry image in Firefox for large ViewBox dimensions
  • Do `overflow-wrap: break-word` and `word-break: break-word` ever behave differently?
  • Visual Studio Code: How to remove html tags and write to multiple lines at the same time?
  • How to make a row of images a vertically and horizontally centered div?
  • How to use specificity with css?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com