Is it good to use both em and px in your design?

As @felgall said:

You should use one or the other for the text on your page and not try to mix them or your page will break.

em is intended for defining text size.

px is intended for defining border widths and image sizes.

Now i use em for text size and px for others. But i still confusing when using both em and px in my design. Example


p{
    font-size: 0.8em;
    padding-bottom: 15px;
}

Is above code ok? Hope everyone give me advice. Thank in advance.

Yes, the above code is OK.

Choose ems when you want the size or space to change in concert with the user’s font size preference.

Use px where you do not want the space to change if the user uses a different font size.

The effect of that code is that the distance below paragraphs before the next element starts will not vary with the font size.

If someone enlarges the font significantly the page will eventually end up with gaps between the paragraphs that are smaller than the gaps between the lines within a paragraph. You’d have to make the font size rather large before that happened though.

thank you so much.

Does your mean is line-height?