Saturday, July 4, 2020

ADVANCED CSS WITH IMAGES

Advanced CSS Training | Udemy

Transparent Image
img{  opacity: 0.5;
}

Flip an Image
img:hover {
  transform: scaleX(-1);
}


Write on Image 

Top Left/ right, bottom left/right
HTML code 

<!DOCTYPE html>
<html>
<head>
      <link rel="stylesheet" type="text/css" href="images.css">
      <title>ANYTHING YOU WANT</title>
</head>

<body>
<div class="container">
     <img src="m1.jfif" >
    <div class="topleft">TopLeft</div>
</div>
</body>
</html>

CSS CODE

.container {
  position: relative;
}

.topleft {
  position: absolute;
  top: 200px;
  left: 16px;
  font-size: 18px;
    

}

Fade in Text:

HTML Fade in code

<!DOCTYPE html>
<html>
<head>
      <link rel="stylesheet" type="text/css" href="images.css">
      <title>ANYTHING YOU WANT</title>
</head>

<body>
<div class="container">
  <img src="d2.jfif" alt="Avatar" class="image">
  <div class="overlay">
    <div class="text">Hello World</div>
  </div>
</div>

    </body>
</html>


CSS Fade in Code
.container {
  position: relative;
  width: 50%;
}

.image {
  display: block;
  width: 100%;
  height: auto;
}

.overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
  opacity: 0;
  transition: .5s ease;
  background-color: #008CBA;
}

.container:hover .overlay {
  opacity: 1;
}

.text {
  color: white;
  font-size: 20px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);

}





0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home