Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

afoysal's avatar

how to make text bold in laravel blade template

I am trying to make text bold in blade template like below

<strong>{!! $accepted_invitation->first_name !!}</strong>

But it is not working.

0 likes
7 replies
vandan's avatar

try this

<span style="font-weight: bold;"> {!! $accepted_invitation->first_name !!} </span>
or
<b> {!! $accepted_invitation->first_name !!} </b>
1 like
Snapey's avatar
Snapey
Best Answer
Level 122

There should be nothing wrong with this

<strong>{!! $accepted_invitation->first_name !!}</strong>

If it is not coming out bold it is because first_name itself contains some html the sets some other style, or because the style for strong has been reset by the css tools that you are using

BUT

You should avoid using {!! !!} at all costs... especially for user generated input. Your code as shown is open to someone doing an xss attack on your site by adding javascript in this field.

Only EVER use raw output if its for data that is part of your codebase or has been carefully sanitised

1 like
vandan's avatar

ok so can i show your full code

or try to display onther method like this

<span style="font-weight: bold;"> {{ $accepted_invitation->first_name }} </span>
or
<b> {{ $accepted_invitation->first_name }} </b>
shariff's avatar

try this one

 <b>   {{$accepted_invitation->first_name }}   </b>
Snapey's avatar

dont use <b>any more. It was dropped from the standard

1 like
afoysal's avatar

You are right "the style for strong has been reset by the css tools that you are using". Thanks.

Please or to participate in this conversation.