Title: Inline style and CCS
Last modified: May 11, 2021

---

# Inline style and CCS

 *  [finnfin](https://wordpress.org/support/users/finnfin/)
 * (@finnfin)
 * [5 years ago](https://wordpress.org/support/topic/inline-style-and-ccs/)
 * Having a bit of a weird issue. I’m trying to set inline style with CCS but it
   seems values aren’t returned at all. Example:
 *     ```
       [related field_name] 
       <div class="box" style="background:[taxonomy level field=level_color];"><h2>content</h2></div>
       [/related]
       ```
   
 * This does not work. I’ve tried double brackets and `''` etc. I’ve checked and
   values do get returned outside the inline style.
 * I’ve also used a Beaver Builder post module, which lets you create custom post
   layouts with HTML. In essence it’s basically a loop. Inside I’ve set the same
   style settings as above but in there, they work fine.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [5 years ago](https://wordpress.org/support/topic/inline-style-and-ccs/#post-14430023)
 * I believe this is due to the shortcode being in an HTML attribute, which is treated
   differently when it’s in a post content. In this case, the `taxonomy` shortcode
   is being run before `related`.
 * There’s a workaround to use double brackets, like `[[` and `]]`, for shortcodes
   inside HTML attribute. Could you try that and see if that solves it?
 *  Thread Starter [finnfin](https://wordpress.org/support/users/finnfin/)
 * (@finnfin)
 * [5 years ago](https://wordpress.org/support/topic/inline-style-and-ccs/#post-14430110)
 * Thanks!
    Yeah I actually tried that because I ran into the issue before. But 
   it doesn’t help in this case. It does help in some cases, but doesn’t seem to
   when inside inline css.
 * Like I mentioned, it works when using a Beaver Builder posts module. There I 
   don’t need to use the `[related]` loop because the module itself does the looping.
   So what you suggested would suggest it should work, but I’m not sure why it doesn’t.
 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [5 years ago](https://wordpress.org/support/topic/inline-style-and-ccs/#post-14430504)
 * You can use `[pass]` to insert stuff in HTML attributes.
 *     ```
       [related field_name] 
       [set myvar][taxonomy level field=level_color][/set]
       [pass vars]
       <div class="box" style="background:{MYVAR};"><h2>content</h2></div>
       [/pass]
       [/related]
       ```
   
    -  This reply was modified 5 years ago by [polarracing](https://wordpress.org/support/users/polarracing/).
 *  Thread Starter [finnfin](https://wordpress.org/support/users/finnfin/)
 * (@finnfin)
 * [5 years ago](https://wordpress.org/support/topic/inline-style-and-ccs/#post-14430683)
 * Thanks! I had tried that too but was stupidly missing the `[/pass]`. Thanks for
   the help again!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Inline style and CCS’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [finnfin](https://wordpress.org/support/users/finnfin/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/inline-style-and-ccs/#post-14430683)
 * Status: not resolved