如何在画布顶部定位div



我有以下html:

<body>
    <input id="slider" type="range" min="0" max="100" step="1"></input>
    <div id="backward" class="button"></div>
    <canvas id="canvas" width="800" height="500" style="border: 1px solid;"></canvas>
    <div id="forward" class="button"></div>
</body>

和以下css:

#canvas{
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 50;
}
.button{
    position: absolute;
    top: 10px;
    z-index: 100;
}

我还需要哪些css来将向后div放置在canvas元素的左侧,将向前div放置在canvas元素的右侧?

如果你想将ID为"向后移动"的div元素;和ID为"forward"的元素;在右边你可以使用属性"right"one_answers";left"。这样的:

#backward{
    left: 10px;
}
#forward{
    right: 10px;
}

如果需要,你可以随时增加或减少。我假设从一开始就没有那么大,而且实际上是合适的。如果没有,你可以在div上添加一个大小

最新更新