Example

Opacity & Transparency

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link name="favicon" type="image/x-icon" href="https://skillzam.com/uploads/system/e353194f3b7cd1b75d69c3ab88041985.png" rel="shortcut icon" />
    <title>Opacity & Transparency</title>

    <style>
        
        .img-container {
            background-color:cornflowerblue;
            width: 40%; 
            padding: 10px;
            border: 4px solid indigo;
        }

        img {
            opacity: 0.5;
        }

        img:hover {
            opacity: 1.0;
        }

    </style>
    
</head>
<body>
<!--
    opacity : specifies the opacity/transparency of an element.
    opacity property can take a value from 0.0 - 1.0. 
    The lower the opacity value, the more transparent it is.
-->

    <h1>Demo: Opacity & Transparency</h1>

    <div class="img-container">
        <img src="/notes/examples/assets/img/avatar.jpg" alt="skillzam logo" style="width:100%">
    </div>
    
</body>
</html>

Output

View original