Composite hydrogels of graphitic carbon nitride nanosheets (CNNS) and polyacrylamide (PAM) with superior UV absorption and visible transparence capabilities are reported. CNNS is employed not only as a photocatalytic initiator to trigger the polymerization of acrylamide, but also as a cross‐linker to 3D connected PAM chains via hydrogen bonds. The obtained CNNS/PAM hydrogels are highly moldable for preparing various forms, and have good mechanical properties, self‐healing ability, and photo‐stability. Furthermore, the composite hydrogels have a wide spectral range for UV absorption compared to conventional UV protective materials. Besides the complete screening of UVB (280–315 nm) in sun radiation, the CNNS/PAM hydrogel film can also filter >95% UVA radiation (315–400 nm) by regulating the coating thickness, meanwhile retaining a high visible transmittance. Therefore, the CNNS/PAM hydrogels have potential applications for shielding UV radiation. Additionally, this strategy provides a common and facile route to fabricate functional composite hydrogels via photo‐induced polymerization.