Engineering porosity and surface functionity in nanoporous organic polymers remains challenging. Here we introduce three different appended functional groups (methyl, ethyl acetate and phenyl) into a novel carbazole-modified polytriazine framework, fulfilling the control of the porosity as well as the functionalization of pore walls. All nanoporous organic polytriazines (NOPs) synthesized display good thermal stability, high BET surface areas and microporosities. The phenyl-anchored framework (NOP-21) exhibits the highest CO2 capacity (12.3 wt% at 273 K/1 bar) and Qst value (CO2, 37kJ/mol). Besides, the highest selectivity based on ideal adsorbed solution theory (IAST) model at 273K was amazingly observed for the ethyl acetate-appended framework (NOP-20): CO2/N2 81 (273K, 1.0 bar). These results suggest a good feasibility for constructing high performance organic porous CO2 sorbents by controlling porosity.