Home > database >  how to write laravel code in css to change value of property
how to write laravel code in css to change value of property

Time:02-10

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

CodePudding user response:

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);

CodePudding user response:

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 }}}"
  • Related