+ 1
How can you make an entire "div" clickable?
I tried putting <a href=" "> before the div but it didn't work
3 ответов
+ 3
<div onclick="foo()">click me!</div>
<script>
function foo(){
window.href = "http://www.example.link"
}
<script/>
+ 11
Notice the usage of
display: flex;
and
flex: 1;
on the inner div
This will maie the inner div fill the parent
Borders are there to illustrate the area of each element
https://code.sololearn.com/Wz35IyCCFUUP/?ref=app
+ 1
thanks so much guys