I am working on updating a sensor value every few seconds and displaying the type of sensor using an image. Here is an example of my code structure:
<div class="sensor">
<img src="images/ssensor.png"
class="img-fluid img-max">
<div class="sensortext">
sensorvalue
</div>
</div>
using the following CSS:
.sensor {
position: relative;
width: 100%;
}
.sensortext {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-30%, -80%);
}
While this setup works well, I encounter issues when resizing the window - the images change size but the text remains static. How can I ensure that they scale proportionally?