AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL

CSS images overlay


<< Previous Page
CSS tutorial
Next Page >>
CSS tutorial

CSS Tutorial » CSS images overlay

What is CSS overlay?
Overlay in webdesign means covering the surface of an element with something. In other words, it is used to put one thing on top of another.
The overlay makes the web page attractive and easy to design.

Useing CSS3 you can add overlay to an element.
In this chapter you will learn about How to overlay an image.

To cover an image with something we use CSS Style as:
Internal - by using a <style> element in the <head> section
External - by using an external CSS Style file as style.css

 

How to Create Image Overlay Hover using HTML - CSS ?

How to Create Image Overlay Hover CSS

To display the overlay fade in a box on mouse hover, we design the HTML - CSS code from the beginning.

For a better understanding we present an example:

Example (this is HTML - PHP editor, change text, values on this window)

<!DOCTYPE html>
<html>
<head>
<title>How do I overlay an image in a div? </title>
<style>
.container {
position: relative;
width: 50%;
}
.image {
opacity: 1;
display: block;
width: 90%;
height: auto;
transition: .5s ease;
backface-visibility: hidden;
}
.middle {
transition: .5s ease;
opacity: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
}
.text {
background-color: #04AA6D;
color: white;
font-size: 16px;
padding: 16px 32px;
}
.container:hover .image {
opacity: 0.3;
}
.container:hover .middle {
opacity: 1;
}
</style>
</head>
<body>

<h2>How do I overlay an image in a div?
</h2>
<p>Hover over the image to see the effect.</p>

<div class="container">
<img class="image" style="width:100%"
src="https://www.agernic.com/images/background-img.jpg" />
<div class="middle">
<div class="text">My background image.<br />
How do I overlay one div over another in CSS?</div>
</div>
</div>

</body>
</html>

Related subjects:
CSS align image center CSS rounded corners image CSS image CSS image center CSS image shadow

 

CSS image overlay on hover

In the following chapters we go deeper:

How do you overlay images on hover?
How do I overlay an image in CSS?
How do you make text appear when hovering over an image in CSS?
How do I add a black overlay to an image in CSS?

CSS image overlay animation



Tags: css image overlay: on hover, gradient, effects, color, fade, animation, text, another image, darken
CSS images overlay - css tutorial

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


CSS Scrollbar Horizontal
CSS Scrollbar in Div
CSS Scrollbar Firefox
CSS Style Scrollbar
CSS Style Text
CSS background color
CSS Div Id Class
CSS Text Wrap
CSS text-align
CSS Text Decoration
CSS Text Shadow
CSS Text Color
CSS Text Bold
CSS Text Size
CSS background image full
CSS background opacity
CSS border radius
CSS rounded corners
CSS font color
CSS Class & ID
CSS align image center
CSS align content
CSS link color
CSS Text Style
CSS Text Font Size
CSS max width &height
CSS width and height
CSS Margin
CSS Padding
CSS Border Style
CSS background
CSS in HTML
Basic Syntax of CSS
CSS Introduction
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


Create a Sticky Navbar with and without ...
CSS Grid Layout. Examples of grid-gap, l...
CSS animation examples: delay, rotate, s...
CSS font weight bold, thin, values, semi...
CSS background color - opacity, gradient...
CSS flex - display: flex - CSS Flexbox L...
CSS border padding...
HTML text center horizontally and vertic...
HTML text input <input type="text"&g...
HTML link color...
How to Link CSS to HTML, external file n...
HTML link - hyperlink...
jQuery replace...
jQuery replaceClass...
jQuery click ()...
jQuery switchClass()...
jQuery draggable()...
jQuery HTML...
jQuery scroll smooth...
jQuery scroll()...