I made a box with <div ></div>
then I styled it in css with .box {}
but I want to make it so when I click the box, it brings me to another page. Here is my current code.
.box18 {
width: 240px; height: 230px;
outline: 5px solid black;
position: absolute; top: 450px; right: 140px;
background-image: url(wfc.jpg);
background-position: top;
}
<div title="Credit: Hasbro/Takara"></div>
I tried to add an anchor tag within the div or within the css styling but it didnt work and made the text dissapear.
CodePudding user response:
You just need to wrap your div in an anchor tag.
.box18 {
width: 240px; height: 230px;
outline: 5px solid black;
position: absolute; top: 450px; right: 140px;
background-image: url(wfc.jpg);
background-position: top;
}
<a href="https://stackoverflow.com" target="_blank">
<div title="Credit: Hasbro/Takara"></div>
</a>