Subject to section 335.2, the board of supervisors may by ordinance regulate and restrict the height, number of structures, and size of buildings and other structures, the percentage of lot that may be occupied, the size of yards, courts, and other open spaces, the density of population, and the location and use of buildings, structures, and land for trade, industry, residence, or other purposes, and may regulate, restrict, and prohibit the use for residential purposes of tents, trailers, and portable or potentially portable structures. However, such powers shall be exercised only with reference to land and structures located within the county but lying outside of the corporate limits of any city.