A central notion under IHL is the principle of proportionality: even if an attack is allowed, it must not be excessive.
www.diakonia.se
The rule does not apply to military targets. If you go to war, and one nation sinks one sub, the rule does not prevent you from destroying their entire navy or armed forces. And having collateral damage--even known collateral damage--isn't forbidden by the rule, as long as it is not "excessive" in relation to the "anticipated military advantage." Those words are vague and can be argued about forever.
The point is, armies should be fighting armies, not butchering unarmed civilians (like Hamas did).
Israel would gladly fight Hamas out in the open and only target them. But they can't because Hamas uses civilians as shields. So the notion of proportionality becomes much more difficult to apply and that is entirely, 100% Hamas's fault. Israel should get some leeway here (not totally off the leash, do whatever you want leeway).
Also, it's worth asking: if one side (Hamas) habitually violates several rules of international war, why should the other party be held to a different standard?