it doesn't matter 17" or 18" rims gap will remain be same.
let me correct myself, gap should remain same, because you need to match diameter of new wheels (17"/18" rims) to stock wheels diameter to have proper reading of your speedometer.
diameter of stock wheels is 25.5".
best tire size for 17" rims would be 215/50/17, but not that many companies produce that size and generaly they expensive, so some ppl buying 215/45/17 or 225/45/17. those tire are smaller then 215/50/17, 215/45 is 3.4% smaller and 225/45 is 2.0% smaller, and that is percentage by what your speedometer will be off by, plus it will open that ugly gap even more.
same thing applies to tires for 18" rims.
best tire size is 215/45/18, but you use 225/40/18 which smaller stock ones by 1.6% and that is still reasonble.