By means of density functional theory computations, we predicted two novel two-dimensional (2D) nanomaterials, namely P2X (X=C, Si) monolayers with pentagonal configurations. Their structures, stabilities, intrinsic electronic, and optical properties as well as the effect of external strain to the electronic properties have been systematically examined. Our computations showed that these P2C and P2Si monolayers have rather high thermodynamic, kinetic, and thermal stabilities, and are indirect semiconductors with wide bandgaps (2.76 eV and 2.69 eV, respectively) which can be tuned by an external strain. These monolayers exhibit high absorptions in the UV region, but behave as almost transparent layers for visible light in the electromagnetic spectrum. Their high stabilities and exceptional electronic and optical properties suggest them as promising candidates for future applications in UV-light shielding and antireflection layers in solar cells.