I want to change the frontend font size from the admin panel in Laravel. Suppose there is a
<h2 class="intro">Introduction to PHP...?? </h2>
in style.css-->>>>
.intro{
font-size:20px;
}
I want this font size dynamic from admin panel by catching the class. If i need 25px i use that or any size I need I will use that.
How can I do that in laravel??? Give me some suggestions to step up…
2
Answers
One way to do this would be via Javascript and your controller:
In your controller, just pass a variable called
$fontSize
to your view file. The with JavaScript, get the element by the class name and set the CSSfont-size
property to whatever value your$fontSize
variable has like this:Remember that the variable you are passing from your controller should not just be an integer, rather it should be something like
20px
30px
2em
etcetera.You can simply use something like this:
Save a file named style.php in the path where the asset files are located. Then use in your base blade file like this:
The fontSize variable is the font size you want to use.
And use in style.php