'how to write laravel code in css to change value of property
background-color: #55ce63;
color: #fff;
content:<? {{__('trans.On')}} ?>;
padding-right: 14px
this code css in header of blade how to write laravel code in css to change
Solution 1:[1]
You can't use php or blade in your css file, but you can set a css variable in your .blade.php file as a style attribute:
style="--content-on: '{{ __('trans.On') }}';"
And use that variable in your css file:
content: var(--content-on);
Solution 2:[2]
I don't recommend using Laravel variables in the CSS file.
Make your style which you want to style with variables inline style in your blade page.
You can try something like this:
style="color:{{{ $var_name }}}"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gert B. |
| Solution 2 | Somar kn |
