var button = document.getElementById('test');
button.style.position = 'relative';
button.style.left = '100px';
button.style.top = '100px';
.pic {
position: relative;
float: left;
width: 250px;
height: 150px;
margin: 0 10px 10px 0;
background-color: #ccc;
background-position: 50% 50%;
background-size: cover;
}
.pic-text {
position: absolute;
background: rgba(0, 0, 0, 0.5);
padding: 5px;
width: 100%;
box-sizing: border-box;
color: #fff;
}
.pic-text.top {
top: 0;
}
.pic-text.bottom {
bottom: 0;
}