I am trying to add css code into head tag. the css style is from shortcodes. title text from shortcode and title color / font size.. etc.
This is an example.

```
<html>
<head>
<?php wp_head(); ?>
.................. (some style, js) .................. 
/* I want to put all of css styles into head tag from into body tags */
</head>
<body>

<?php

//shortcode css from user custom option

add_action( 'wp_head', 'iulia_example' );

function iulia_example() { 

echo '<style type="text/css">
   .sc_title {color:#fff; font-weight:600;}
 </style>';
} 
?>
  <!-- shortcode -->
  <div class="sc_wrap">
   <h1 class="sc_title">Hello This is the title</h1>
  </div>
</body>
</html>

```

I want to use wp\_head hook to place css style in head tag. however it's not working.
Is there another way to add the css code in head? wp\_head is not working in "body tag" and it gets the custom css variables from shortcode and it's in BODY.

Thank you,