*
targets all elements.
::before
and ::after
are pseudo elements so aren't targeted by the *
so to target these as well you use the code you used in the OP.
You can do a site without using pseudo elements at all it's just there for the people that do use them so they have a consistant box-model and don't start scratching their heads when they go to use a ::before
or ::after
and it's calculated differently.