abc

Share This blog with your friends, so that we can improve more & more . our aim is to easy & simple way of learning.

12/14/2020

How to create Responsive Image(All Devices good view) with Transparent text

 <html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

* {

  box-sizing: border-box;

}


 


.container {

  position: relative;

  max-width: 800px;

  margin: 0 auto;

}


.container img {vertical-align: middle;}


.container .content {

  position: absolute;

  bottom: 0;

  background: rgb(0, 0, 0); 

  background: rgba(0, 0, 0, 0.5); 

  color: #ffffff;

  width: 100%;

  padding: 20px;

}

</style>

</head>

<body>


<h5>Responsive Image with Transparent Text</h5>


<div class="container">

  <img src="trial.jpg" alt="background" style="width:100%;">

  <div class="content">

    <h1>Heading</h1>

    <p>Sample Text here Sample Text hereSample Text hereSample Text hereSample Text hereSample Text here.</p>

  </div>

</div>


</body>

</html>


in above example if you observe class 'content' which text overlay and transparent view using background: rgba(0, 0, 0, 0.5); 


RGBA - set opacity of rgb(red, green, blue) color , in above 0.5 means transparent to background up to half.

Share your valuable comment.

No comments:

Post a Comment

An Introduction to the Laravel Framework: What It Is and Why You Should Use It

  If you're a PHP developer looking for a modern, efficient, and powerful framework to build web applications, look no further than Lara...