'Laravel dompdf not displayng as the view

I am trying to generate a book cover, in my blade view it looks ok but when I generate the pdf it doesn't look like the preview

Book front preview

PDF Generated

my blade view:

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="css/style.css">
    <title>Cover</title>
</head>
<body class="bg-cover-blue">
    <div>
        <h1 style="margin-left: 880px;margin-top: 290px;"> {{ $title }}</h1>
        <p style="margin-left: 980px;"> {{ $owner }}</p>
    </div>
</body>
</html>

my css:

.bg-cover-blue{
    background-image: url(../img/covers/blue.jpg);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}
$data = ['title' => $title, 'owner' => $owner, 'color' => $covercolor,]; $pdf = PDF::loadView('pdf.covertest', $data) ->save(storage_path('../public/pdf/cover/') . 'cover'.$id.'.pdf');


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source