Source Code: (back to article)
<!DOCTYPE html>
<html>
<head>
<title>Der Titel des Dokuments</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
div.img-block {
width: 100%;
height: 450px;
background-image: url("/uploads/media/default/0001/01/25acddb3da54207bc6beb5838f65f022feaa81d7.jpeg");
background-repeat: no-repeat;
background-size: contain;
border: 1px solid black;
}
h1 {
padding: 0 10px;
color: #fff;
}
</style>
</head>
<body>
<p>Ändern Sie die Größe des Browserfensters, um den Effekt zu sehen.</p>
<div class="img-block">
<h1>Ihr Hintergrundbild</h1>
</div>
</body>
</html>