If you're looking to add a link using CSS to that specific div
, it might not be achievable based on my understanding. Here are a couple of options you can consider:
HTML:
Enclose the div
within an <a>
tag
<a href="https://www.google.com/"><div></div></a>
CSS:
div {
background: url(https://www.google.com/images/srpr/logo11w.png) no-repeat;
width: 570px;
height:150px;
}
See DEMO HERE
Alternatively, you can place the <a>
element inside the div
and adjust its height
and width
properties while adding display: block;
. This method is more recommended as it follows proper syntax. The previous approach may work but could be considered more of a workaround.
HTML:
<div><a href="https://www.google.com/"></a></div>
CSS:
div {
background: url(https://www.google.com/images/srpr/logo11w.png) no-repeat;
width: 570px;
height:150px;
}
a {
width: 100%;
height: 100%;
display: block;
}
Check out the DEMO HERE
I hope this information proves helpful.