I have a div that must have an auto width determined by the length of the text inside it. My goal is to display a blue halo as a background image when hovering over the button with my mouse.
Here's the challenge I'm facing: I want the blue halo png image to stretch to match the exact width of the div, creating a distorted effect without maintaining any proportions.
Is there a way to achieve this without specifying an absolute value for the width of the div? And using only HTML and CSS3?
HTML side:
<div class="button">
<p>Hover here!</p>
</div>
CSS side:
.button {
width: auto;
height: 80px;
line-height: 81px;
font-family: sans-serif;
display: inline-block;
}
.button:hover {
background: url("http://img15.hostingpics.net/pics/300291bluehalo.png") center bottom no-repeat;
}
JSFiddle: https://jsfiddle.net/ynwsmkrz/5/