JSFiddle - React, Tailwind, and code Playground

by pj_js15

HTML

<!DOCTYPE html>
<html>
<head>
	<title>Background Image with Transparent Section</title>
	<style>
		.background-image {
		  
			background-image: url('your-image-url.jpg');
			background-position: center;
			background-size: cover;
			height: 460px; /* adjust to your preferred height */
      width: 400px;
      border: 1px solid gray;
			position: relative;
			overflow: hidden;
      background-color: green;
		}

		.background-image::after {
			content: "";
			display: block;
			position: absolute;
			bottom: 0;
			left: 0;
			width: 100%;
			height: 200px; /* adjust to your preferred height */
			background-color: rgba(0, 0, 0, 0.5); /* adjust the transparency as needed */
			z-index: 1;
		}

		.background-image p {
			position: absolute;
			bottom: 50px; /* adjust the distance from the bottom as needed */
			left: 50px; /* adjust the distance from the left as needed */
			color: white;
			font-size: 24px;
			z-index: 2;
		}
	</style>
</head>
<body>
	<div class="background-image">
		<p>This is a sample text description.</p>
	</div>
</body>
</html>