Polymeric sorbents for carbon dioxide are provided. More particularly, the polymeric sorbents are a reaction product of a divinylbenzene/maleic anhydride precursor polymeric material with a nitrogen-containing compound. The nitrogen-containing compound is covalently attached to the polymeric sorbents. Additionally, methods of sorbing carbon dioxide on the polymeric sorbents and compositions resulting from sorbing carbon dioxide on the polymeric sorbents are provided. The polymeric sorbents typically are porous and can selectively remove carbon dioxide from other gases such as methane or hydrogen.