We report the bandgap and electronic properties of wurtzite ZnO doped with elements IIA or/and IIIA, investigated using both theoretical and experimental methods. With wurtzite ZnO co-doped with B and Mg (denoted as ZnO:[B,Mg]) grown via metalorganic chemical vapor deposition, we have observed that both the bandgap and the conductivity can be widely tunable with the doping levels. From first-principles calculations of wurtzite ZnO:Mg, we show that IIA doping elements have a great impact on the widening of the bandgap. Also, from a newly developed calculation method for investigating the electronic properties of wurtzite ZnO:Al, we have found that IIIA doping elements play an important role in tailoring the conductivity.