Hydrogen bonding comes into existence as a result of dipole-dipole interactions between the molecule in which hydrogen atom is covalently bonded to a highly electronegative atom.
Therefore, the conditions for the effective hydrogen bonding are:
(i) high electronegativity of the atom bonded to hydrogen atom so that bond is sufficiently polar.
(ii) the small size of the atom bonded to hydrogen so that it is able to attract the bonding electron pair effectively.
If the atom bonded to hydrogen has the low value of electronegativity and/or large atomic size, dipole-dipole interactions are not strong enough to allow effective hydrogen bonding.
Only nitrogen, oxygen and fluorine form strong hydrogen bonds because they have the high value of electronegativity and small atomic size.