0

I've thrown my data to my blade. I'm using inline css. In this case, I need background: url(..) instead of <img>. On browser when i inspect and open the img in new file it opens but css is unable to parse and display it. Should i give it some more location?

Currently, I'm trying this out.

<div class="row profile-cover" style="margin: 0; 
background: url('{{$userDetails->profile_img}}')">

where

$userDetails->profile_img= gallery/client4/avatar_1530513317_1532258485.jpg;
deceze
  • 510,633
  • 85
  • 743
  • 889
rakesh shrestha
  • 1,335
  • 19
  • 37
  • Read this https://stackoverflow.com/questions/15734546/using-html-data-attribute-to-set-css-background-image-url – Goku Jul 25 '18 at 12:35

1 Answers1

0

You can write this. Hopefully this will solve your problem

<div class="row profile-cover" style="margin: 0; background: url({{ asset($userDetails->profile_img) }})">

Or

<div class="row profile-cover" style="margin: 0; background-image: url({{ asset($userDetails->profile_img) }})">
Jahid Mahmud
  • 1,136
  • 1
  • 12
  • 32