Blur And Change Image Color Using CSS3

Datetime:2016-08-23 03:07:53          Topic: CSS3           Share

Tags:-CSS3 HTML

In this tutorial we will show you how to blur and change the color and apply filter to image using CSS3.You may also like Image Zoom In On Hover Using CSS3

See Demo

To Blur And Change The Color Of Image It Takes Only Two Steps:-

  1. Make a HTML file and define markup
  2. Make a CSS file and define styling

Step 1.Make a HTML file and define markup

We make a HTML file and save it with a name change_color.html

<html>
<head>
<link rel="stylesheet" type="text/css" href="change_style.css">
</head>
<body>
<div id="wrapper">

<div id="img1_wrapper">
 <img src="images/image1.jpg" id="grey_img">
</div>
<div id="img2_wrapper">
 <img src="images/image2.jpg" id="white_img">
</div>
<div id="img3_wrapper">
 <img src="images/image3.jpg" id="blur_img">
</div>

</div>
</body>
</html>

In this step we use three images to show 3 different effects on images.You may also like Rotate And Flip Images Using CSS3

Step 2.Make a CSS file and define styling

We make a CSS file and save it with a name change_style.css

body
{
 width:100%;
 margin:0 auto;
 padding:0px;
 background-color:#6C1A1A;
 font-family:helvetica;
 text-align:center;
}
#wrapper
{
 text-align:center;
 margin:0 auto;
 padding:0px;
 width:995px;
}
h1
{
 margin-top:50px;
 color:#E39F9F;
}
h1 p
{
 font-size:14px;
 color:white;
}
#wrapper div
{
 width:300px;
 margin:30px;
}
#wrapper img
{
 width:100%;
}
#img1_wrapper:hover
{
 background-color: #A4A4A4;
}
#grey_img:hover
{
 -webkit-opacity: 0.4;
 -moz-opacity: 0.4;
 -o-opacity: 0.4;
 -ms-opacity: 0.4;
 opacity: 0.4;
	
 -webkit-filter: alpha(opacity=40);
 -moz-filter: alpha(opacity=40);
 -o-filter: alpha(opacity=40);
 -ms-filter: alpha(opacity=40);
 filter: alpha(opacity=40);
}
#img2_wrapper:hover
{
 background-color: #E6E6E6;
}
#white_img:hover
{
 -webkit-opacity: 0.4;
 -moz-opacity: 0.4;
 -o-opacity: 0.4;
 -ms-opacity: 0.4;
 opacity: 0.4;

 -webkit-filter: alpha(opacity=40);
 -moz-filter: alpha(opacity=40);
 -o-filter: alpha(opacity=40);
 -ms-filter: alpha(opacity=40);
 filter: alpha(opacity=40);
}
#blur_img:hover
{
 -webkit-filter: blur(4px);
 -moz-filter: blur(4px);
 -o-filter: blur(4px);
 -ms-filter: blur(4px);
 filter: blur(4px);
}

In this step we useCSS3 opacity to show different effects and then we use CSS3 filter property to change the color and blur the image.

Thats all, this is how to blur and change the color using CSS3.You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.





About List