Norway essentially does this. Taxes are based on engine size and (I believe) weight. The relative price difference between a large SUV and a small, low horsepower, hatchback is much greater than in most other countries. However based on casual observations in and around Oslo, it doesn't seem to have a huge effect on the size of cars people drive.
The real effect is the 'everybody' owns a Tesla since they are exempt for many taxes and thus cost literally half the price of an equivalently performing petrol powered car.