In the code that you proposes the selector only works if previously added the attributes in the HTML. It is easier if you load a specific stylesheet just for certain users:
Create a new CSS file with the specific styles, something like specific.css
.just-for-user-b {
color: #ffffff;
}
Add this code to your functions.php
<?php
/**
* Load CSS only for specific logged-in users.
*/
function load_specific_css() {
$user = wp_get_current_user();
if ( $user ) {
$auth_users = array( "B" ); // You can add users.
if ( in_array( $user->user_login, $auth_users ) ) {
wp_enqueue_style( 'specific-styles', get_stylesheet_directory_uri() . '/specific.css' );
}
}
}
add_action( 'wp_enqueue_scripts', 'load_specific_css', 10 );
By this way you keep the specific styles separated and easy to maintain, the CSS file only will be loaded by the specific logged in users.