Last active
August 5, 2020 13:49
-
-
Save mrkpatchaa/e0aaaeacf3c7bf9ccf7301382dc69cea to your computer and use it in GitHub Desktop.
Text overlay on image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<style> | |
.overlay-image { | |
position: relative; | |
width: 900px; | |
height: 600px; | |
background: url(https://images.unsplash.com/photo-1565191999001-551c187427bb?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1650&q=80) no-repeat center center fixed; | |
background-size: cover; | |
} | |
.overlay { | |
position: absolute; | |
top: 0; | |
bottom: 0; | |
left: 0; | |
right: 0; | |
height: 100%; | |
width: 100%; | |
background-color: rgba(0, 0, 0, 0.75); | |
} | |
.image { | |
max-width: 100%; | |
} | |
.text { | |
color: #fff; | |
padding: 10px; | |
font-size: 25px; | |
line-height: 1.5em; | |
text-shadow: 2px 2px 2px #000; | |
text-align: center; | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
width: 95%; | |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; | |
} | |
</style> | |
<body> | |
<div class="overlay-image"> | |
<div class="overlay"> | |
<div class="text">Lorem ipsum dolor sit amet consectetur adipisicing elit. Tenetur officiis fugit et facilis | |
quos quod sunt. Dolorem fugit ad magni aspernatur, sit illo, dolorum minus esse delectus sint, officia | |
saepe.</div> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment