close[x]


CSS

CSS-Home CSS-Environment CSS-Basic syntax CSS-Selector CSS-How To Add CSS CSS-Comment CSS-Color CSS-Background CSS-Font CSS-Text CSS-Boarder CSS-Margin CSS-Padding CSS-Height/Width CSS-Link CSS-Table CSS-Visibility CSS-Scrollable CSS-Float/Clear CSS-Line CSS-Align CSS-Dimension CSS-Event CSS-Pusedo class CSS-Position CSS-Transparency CSS-Dropdown CSS-Form CSS-List/Counter CSS-Website layout CSS-Text effect CSS-Image effect CSS-Button effect CSS-page number CSS-Box CSS-@media CSS-Multi device CSS-Multi device 1 CSS-Multi device 2



learncodehere.com




CSS - Image Effects

With CSS you can create many kind of image effects that may help you to design your website.

In this tutorial you will cover about the following image effect properties.

  • border-radius : this property used to create rounded images
  • border : this property used to create thumbnail images.
  • transform : this property used to create an overlay effect on hover.

  • Example :Image Effects

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    img {
    border-radius: 50%;
    }
    /*-------*/
    .container {
    position: relative;
    width: 50%;
    }
    .image {
    display: block;
    width: 100%;
    height: auto;
    }
    .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #008CBA;
    overflow: hidden;
    width: 100%;
    height: 0;
    transition: .5s ease;
    }
    .container:hover .overlay {
    height: 100%;
    }
    .text {
    white-space: nowrap;
    color: white;
    font-size: 20px;
    position: absolute;
    overflow: hidden;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    }
    </style>
    </head>
    <body>
    <h3>Rounded and Effected by Mouse hover Image</h3>
    <div class="container">
    <img src="css.png" alt="css" class="image">
    <div class="overlay">
    <div class="text">CSS</div>
    </div>
    </body>
    </html>

    When the above code is compiled , it produces the following result.

    Result

    Rounded and Effected by Mouse hover Image

    Avatar
    CSS



    Example : Polaroid Images

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    body {margin:25px;}
    div.polaroid {
    width: 80%;
    background-color: white;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    margin-bottom: 25px;
    }
    div.container {
    text-align: center;
    padding: 10px 20px;
    }
    .polaroid:hover {
    box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);
    }
    </style>
    </head>
    <body>
    <h2>Responsive Polaroid Images / Cards</h2>
    <div class="polaroid">
    <img src="css.jpg" alt="css" style="width:100%">
    <div class="container">
    <p>CSS</p>
    </div>
    </div>

    </div>

    </body>
    </html>

    When the above code is compiled , it produces the following result.

    Result

    css