Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Laravel: How to change div font

I am displaying a greeting to the user on my dashboard page, how can I change the first 2 words (the div) to be a larger, maybe even a different font? Can I add a space margin underneath too, to separate the greeting from the rest? (This is me trying to learn Laravel) Thank you 🙂

So far I’ve tried:

<div>
    @isset($user)
    <style type="text/css">
        @font-face {
            font-family: Muli-Bold;
            src: url('{{ public_path('fonts/materialdesignicons-webfont.ttf') }}');
        } // I guess I need an @endfont-face here, but for some reason my ide wasn't recognizing it
    </style>
        Hallo {{ $user->name }},
    @endisset
</div>
<div>Willkommen im  <b class="text-gray-700">Formular-Editor!</b></div>
<div>Neue Formulare kannst du über den Tab <i><b class="text-gray-700">"Editor"</b></i> oben in der Leiste anlegen. Hier kannst Du auch bestehende Formulare bearbeiten.</div>

(I’ve also tried putting "hello user" into the style component/tag)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

also like this:

<div font-size="3"> 
    Hallo {{ $user->name }}
</div>

But they haven’t worked. What’s the best way to make it work without insalling trailhead?

>Solution :

Move your @isset($user) to wrap the <div> element and apply your styles on the <div>. There is no point performing @isset($user) inside the <div> as all that will do is render a redundant empty element.

@isset($user)
<div style="font-family: Muli-Bold; font-weight: bold; text-decoration: underline; padding-bottom: 10px;">
    Hallo {{ $user->name }},
</div>
@endisset

You can apply any other css styles you want in the same manner, however, it would be better to define one or more classes which encapsulate the required styling and then apply the class to your elements.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading