Skip to content

Truly independent web browser

1.4 KB
Raw Blame
<!DOCTYPE html>
<script src="../include.js"></script>
<style>
    body {
        margin: 0;
    }
    .scene {
        position: absolute;
        top: 50px;
        left: 50px;
        width: 200px;
        height: 200px;
        perspective: 1000px;
    }
    .card {
        position: relative;
        width: 200px;
        height: 200px;
        transform-style: preserve-3d;
    }
    .front {
        width: 200px;
        height: 200px;
        background: green;
        backface-visibility: hidden;
    }
    .back {
        position: absolute;
        top: 0;
        left: 0;
        width: 200px;
        height: 200px;
        transform: rotateY(180deg);
        backface-visibility: hidden;
    }
    .button {
        width: 100px;
        height: 100px;
        background: red;
        transform-style: preserve-3d;
    }
</style>
<div class="scene">
    <div class="card">
        <div class="front" id="front"></div>
        <div class="back"><div class="button" id="button"></div></div>
    </div>
</div>
<script>
    test(() => {
        // The button sits in the card's back face, which faces away, so a point over it hits the front face.
        // The flipped back face mirrors the button to the card's right half.
        println(`left half: ${document.elementFromPoint(100, 100).id}`);
        println(`right half: ${document.elementFromPoint(200, 100).id}`);
    });
</script>