Home > Mobile >  Laravel: How to change div font
Laravel: How to change div font

Time:10-17

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 >Formular-Editor!</b></div>
<div>Neue Formulare kannst du über den Tab <i><b >"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)

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?

CodePudding user response:

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.

  • Related