简体   繁体   中英

show a specific image as watermark background on my blade.php? Laravel

I want to make a watermark on a specific page on my project.

I write this in app.css

.watermarked {
  position: relative;
}

.watermarked:after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0px;
  left: 0px;
  background-image: url("../images/SystemLogo.png");
  background-size: 100px 100px;
  background-position: 30px 30px;
  background-repeat: repeat;
  opacity: 0.7;
}

and this is my blade

@extends('layouts1.index')

@section('content')

<div class="container">
  <head>
<meta charset="UTF-8">
</head>

  <body>
    <div class="watermarked">
  <div class="text-center">

     <h2 class="text-center"> Appri=oval report </h2>
      <form method="post" action="/student/share-approval/{{$approval->uniid}}">
         @csrf
<p lang="ar" dir="rtl">
  // here is the  approval report 
</p>
<button type="submit" class="btn btn-primary">share the report </button>
</div>
</div>
       </body>
    </form>
  </div>
@endsection

The problem is not showing the watermark as the image I want.. the result is a default background. How can I show the image as a background?

I think your HTML is formatted incorrectly. The ending form tag and div is below the body tag.

Try this:

 .watermarked { position: relative; }.watermarked:after { content: ""; display: block; width: 100%; height: 100%; position: absolute; top: 0px; left: 0px; background-image: url("https://en.opensuse.org/images/4/49/Amarok-logo-small.png"); background-size: 100px 100px; background-position: 30px 30px; background-repeat: repeat; opacity: 0.7; }
 <div class="watermarked"> <div class="text-center"> <h2 class="text-center">Stuff here</h2> <form method="post" action="/#"> <p> A Form here </p> <button type="submit" class="btn btn-primary">Button</button> </form> </div> </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM