The CSS code you’re seeing is added by core of WP when admin bar is showing.
The function that outputs it is called _admin_bar_bump_cb()
and it’s called as hook on wp_head
.
So how to get rid of it? Just remove this action from that hook:
function remove_admin_bar_bump() {
remove_action( 'wp_head', '_admin_bar_bump_cb' );
}
add_action('get_header', 'remove_admin_bar_bump');
Then you can add it in your CSS and use body.admin-bar
as context if you want to add some styles only if the admin bar is visible.