I have an element E that is 1000px wide, that is within a parent container P.
Of E's 1000 pixels of width, the columns x position 600–800px are more important than the others, so as its parent element gets narrower, I'd like to position E within P so that these pixels are visible and centred within P (until this is no longer possible).
So, if P can fit the entire width of E, no problem! Just centre E within P:
┌──────────────────────────────────────────────────────────────┐
│P │
│ ┌─────────────────────────┬──────────────┬───────┐ │
│ │E │Important█████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ │ │██████████████│ │ │
│ └─────────────────────────┴──────────────┴───────┘ │
│ │
└──────────────────────────────────────────────────────────────┘
However, if the parent is resized to be e.g. 250px wide, E should be centred around x=700px:
┌───────────────────────────┐
│P │
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┼─────┬──────────────┬──────│
E │ │Important█████│ ││
│ │ │██████████████│ │
│ │██████████████│ ││
│ │ │██████████████│ │
│ │██████████████│ ││
│ │ │██████████████│ │
│ │██████████████│ ││
│ │ │██████████████│ │
│ │██████████████│ ││
│ │ │██████████████│ │
│ │██████████████│ ││
│ │ │██████████████│ │
│ │██████████████│ ││
│ │ │██████████████│ │
│ │██████████████│ ││
│ │ │██████████████│ │
│ │██████████████│ ││
│ │ │██████████████│ │
│ │██████████████│ ││
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┼─────┴──────────────┴──────│
│ │
└───────────────────────────┘
Is this possible to achive with CSS? (Maybe using calc()?)
Bonus: Is it possible to have the overflow be scrollable? (If so, I guess JS is needed?)