Graphene is one of the promising two-dimensional atomic materials with a zero band gap. However, a finite band gap is needed in order to applying graphene for field-effect transistors with high on-off ratio. Band gap opening has been expected theoretically for laterally confined ribbons of graphene. Here, I will present the experimental approach of the selective and precise growth of subnanometer wide graphene nanoribbons (GNRs). Spatially well- aligned GNRs have been prepared and characterized by scanning tunneling microscopy and direct/inverse photoemission spectroscopy, revealing the existence of a finite band gap for the 7-armchair GNRs. Furthermore, decorating nonhexagonal rings into the honeycomb lattice is an effective way to tailor the electronic structures and magnetic properties of graphene. But nonhexagonal rings are usually energetically unstable compared to the hexagonal counterparts, making it challenging to embed nonhexagonal rings in a controllable manner. I will talk about the on-surface synthesis of GNRs periodically embedded with four- and eight-membered carbon rings. It was found that the nonhexagonal rings as a topological modification dramatically change the electronic properties of the nanoribbons.