I don’t know if you try to add a css file in your theme or plugin. I will provide both examples. Use wp_enqueue_style in combination with get_theme_file_uri to enqueu a stylesheet in your theme directory.
For a theme, see example
function add_styles() {
wp_enqueue_style( 'fontawesome-style', get_theme_file_uri( '/assets/css/all.css' ), array(), null );
}
add_action( 'wp_enqueue_scripts', 'add_styles' );
For a plugin, see example
function add_styles() {
wp_enqueue_style( 'example-styles-plugin', plugins_url('/assets/css/admin.css', __FILE__), array(), null );
}
add_action( 'wp_enqueue_scripts', 'add_styles' );
For both, add an external URL:
function add_styles() {
// Add Google Fonts
wp_enqueue_style('google_fonts', 'https://fonts.googleapis.com/css?family=Poppins:300,500,700', array(), null );
}
add_action( 'wp_enqueue_scripts', 'add_styles' );