Hover box – text over images on hover and more… | blushdsm.com
Hover box is a component with additional hidden text layer, which becomes visible on hover and covers original box with image — in few combinations. Feel free to download it in package or as a single css file and use it in your project. Or just read the instructions how to make it by yourself. If the image is too large, you need to define width by parent element e. The only exception is in second example with image as a background on bottom layer — here you must write a rule in CSS to define width and height of the box. In this case the box width and height depend on provided image size.
Setting the width of the element will prevent it from stretching out to the edges of its container. The element will then take up the specified width, and the remaining space will be split equally between the two margins:. To just center the text inside an element, use text-align: For more examples on how to align text, see the CSS Text chapter. To center an image, set left and right margin to auto and make it into a block element:.