I have divided an html page into four sections. I have created four buttons inside it which contain images. I also want text to be displayed at the center of each button. But due to the images the texts are moving below the button. Please tell me how to achieve this.
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
button {
width: 50%;
height: 50%;
float: left;
margin: 0;
padding: 0;
cursor: pointer;
text-align: center;
}
button img {
width: 100%;
height: 100%;
}
button:hover {
opacity: 0.4;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Nature</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<button><img src="https://images.unsplash.com/photo-1514361107497-ca601745d27a?ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80" alt="">Himalaya</button>
<button><img src="https://images.unsplash.com/photo-1508831084156-40f6573bbe6b?ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80" alt=""></button>
<button><img src="https://images.unsplash.com/photo-1585889574476-af7bcb00d9c3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1050&q=80" alt=""></button>
<button><img src="https://images.unsplash.com/photo-1543763479-fb7533fcbf3b?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1050&q=80" alt=""></button>
<script src="script.js"></script>
</body>
</html>