I have a field and when you click on Google
the website opens. But my problem is that I want to click on the whole field and not only on the text!
.section {
display: flex;
justify-content: center;
}
.alignment {
width: 500px;
}
#back-style {
text-align: center;
color: white;
background-color: #e6e6e6;
line-height: 2.5;
}
<section class="section">
<div class="alignment">
<div id="back-style">
<a href=https://www.google.com">Google</a>
</div>
</div>
</section>
2
Answers
Consider making
#back-style
the link element. You’d need to applydisplay: block
and removecolor: white
to have it look the same as your original code.The < a > tag is what makes something clickable. It should extend across the whole section that you want to be clickable, so I pulled it out of the div: