Laravel 10 - How to Use New @style Attribute

Laravel 10 - How to Use New @style Attribute

 Laravel 10 - How to Use New @style Attribute

I'll show you how to use @style in our Laravel app. Using this directive we can easily add any style to that tag. So, let's see how we can use this @style attribute.

Note: Tested on Laravel 10.0 

Table of Contents

  1. Example 1
  2. Example 2

Example 1

If we back to the previous moments, where if we need any change in style, we need to use so called @if @endif directiveLike below

    $isActive = false;

    <span style="background-color: red; color: white;">When $isActive is true</span>
    <span style="background-color: red;color: green">When $isActive is false</span>

<span style="background-color: red; font-weight: bold;">hello</span>

Thank you for being so supportive!


Post a Comment