+ 1

How can you make an entire "div" clickable?

I tried putting <a href=" "> before the div but it didn't work

25th Jan 2019, 9:07 AM
Israel Nwangwu
Israel Nwangwu - avatar
3 Réponses
+ 3
<div onclick="foo()">click me!</div> <script> function foo(){ window.href = "http://www.example.link" } <script/>
25th Jan 2019, 9:28 AM
Etabeta1🇮🇹
Etabeta1🇮🇹 - avatar
+ 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
25th Jan 2019, 10:15 AM
Burey
Burey - avatar
+ 1
thanks so much guys
26th Jan 2019, 6:45 AM
Israel Nwangwu
Israel Nwangwu - avatar