Is there a way to change the CSS resize corner's position?

Here's one starting point. I essentially created a custom resize icon in the upper right corner. I then used 'mousedown', 'mousemove' and 'mouseup' events to track resizing activity. You might be able to do something similar using 'drag' and related events.

Note the 'mousedown' is on the resize icon, while 'mousemove' and 'mouseup' are on the document body (or some other larger element behind the resizable div).

I've hard-coded the width and height in the JavaScript for the sake of simplicity. That means those values exist in two different places which is not good. You should probably put them only in JavaScript or only in CSS, not in both as I have done.

I needed to put the resizable div into a container that filled the body. Otherwise 'mousemove' events outside of the resizable div were not registered. This might not be an issue if you already have other content "behind" your absolutely positioned resizable element.

For your information: I also initially tried using the native resize functionality. I used transform: rotate(-90deg) to move the resize corner to the upper right, then put in an inner div with transform: rotate(90deg) to make the inside content the right-way-up again. However, while this put the resize corner in the correct place, the resizing itself was completely messed up, as the mouse movements and the actually resizing itself were off by 90 degrees. It's a little hard to describe in words, but suffice it to say that, without some major re-working (or perhaps some brilliant code or hidden function) I couldn't get that strategy to work.

var
  doc = document,
  ht = 400,
  wd = 400,
  main = document.querySelector("#resizable"),
  x, y, dx, dy;

var startResize = function(evt) {
  x = evt.screenX;
  y = evt.screenY;
};

var resize = function(evt) {
  dx = evt.screenX - x;
  dy = evt.screenY - y;
  x = evt.screenX;
  y = evt.screenY;
  wd += dx;
  ht -= dy;
  main.style.width = wd + "px";
  main.style.height = ht + "px";
};

rsz.addEventListener("mousedown", function(evt) {
  startResize(evt);
  doc.body.addEventListener("mousemove", resize);
  doc.body.addEventListener("mouseup", function() {
    doc.body.removeEventListener("mousemove", resize);
  });
});
#container {
  position: absolute;
  border: solid red 1px;
  margin: 0;
  height: 100%;
  width: 100%;
}
#resizable {
  display: block;
  font-size: 9pt;
  position: absolute;
  bottom: 50px;
  left: 20px;
  padding: 10px;
  min-height: 0;
  min-width: 0;
  border: solid 1px black;
  width: 400px;
  height: 400px;
  overflow-x: auto;
  overflow-y: hidden;
}
#rsz {
  position: absolute;
  right: 0;
  top: 0;
  width: 20px;
  height: 20px;
  background-color: rgba(255, 0, 0, 0.5);
}
#original {}
<div id="container">
  <div id="resizable">
    <div id="rsz"></div>
    (some content)
  </div>
</div>

If you run this code snippet from within Stack Overflow, you need to expand the running view area by clicking on "Full page" after clicking "Run code snippet".


Here's a hack for you:

.outer-ne-resize {
  resize: both;
  overflow: auto;
}

.inner-ne-resize,
.outer-ne-resize {
  transform: rotateX(180deg);
  height: 100%;
  width: 100%;
}

.content {
  height: 100%;
  background-color: lightgray;
}
<div class="outer-ne-resize">
  <div class="inner-ne-resize">
    <div class="content">
      <p>Lorem ipsum content Lorem ipsum content Lorem ipsum content.<br>
      Lorem ipsum content Lorem ipsum content Lorem ipsum content.
      </p>
    </div>
  </div>

The problem with this hack, is that it still resizes in the same nwse direction, as indicated by the cursor. This means that when you pull down from the top it doesn't shrink, it expands from the bottom.


Another dirty hack: set the direction of the container to rtl and the corner will be on the left

.resizable {
    resize: both;
    overflow: auto;
    direction: rtl
}

Remember that you will need to set the direction back to ltr in the inner div, so the text is displayed as you would expect it to:

.content {
    direction: ltr
}