This question is quite similar to another one I came across. The main difference that's stumping me is the CSS value increment.
In the previous question, there was an element on the page with a negative margin, and I wanted it to increase by 1 pixel each time the screen size increased by 1 pixel, starting from 1400px wide and up.
.element {
margin-left: -195px;
}
So, if the window size was 1440px wide, the margin-left of the element should be -195px. If the window size was 1441px wide, the margin-left should be -194px, or if it was 1451px wide, the margin-left should be -184px, and so forth.
The responses were fantastic and helped me resolve it using CSS or JavaScript.
.........................
However, after implementing the solution, I realized that instead of a 1-pixel increment, the element's margin actually needs only a 0.1-pixel increment:
So:
If the window size is 1440px wide, the margin-left of the element should be -195px.
If the window size is 1441px wide, the margin-left should be -194.9px.
Or if the window size is 1452px wide, the margin-left should be -193.8px, and so on.
Starting at 1400px wide and up.
I understand that these questions are very similar, but this one seems to present a new challenge.
IMPORTANT NOTE: What I need is a dynamic margin-left value that increases based on screen size, rather than being fixed within a range of screen sizes through media queries. Implementing a huge number of media queries is not an option for me.
Is this achievable with JavaScript, jQuery, or even CSS?