Help - Search - Members - Calendar
Full Version: full page background image with CSS.
HTMLHelp Forums > Web Authoring > Cascading Style Sheets
kl2017
How do I add a hyperlink URL to the image being used as a CSS full page background image?
Where does the url hyperlink get inserted? And what is the correct coding?

<!DOCTYPE html>
<html>
<head>
<style>
body, html {
height: 100%;
margin: 0;
}

.bg {
/* The image used */
background-image: url("index.png");

/* Full height */
height: 100%;

/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
</style>
</head>
<body>

<div class="bg"></div>

</body>
</html>
pandy
In your case inside DIV.bg. But why do you use a 100% high DIV instead of applying the background to BODY?
Christian J
It would be better to replace the DIV with a link, or put the link outside the DIV, otherwise the link won't cover the whole viewport.
pandy
Is the link supposed to cover the whole viewport?
Christian J
It sounded like the OP wanted the BG image "inside" the link, so if the image covered the viewport, the link must do it too...
pandy
It did? unsure.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2019 Invision Power Services, Inc.