0

So I have this image and its working on the main page of the web that Im working but when I try to put image for background in every page that this button redirects:

<a href="{{url('building', $building->id)}}"class="btn btn-primary btn-sm">Offices</a>

It doesnt show any background image I put the png file in the public folder

This is the css for the main page its working

.buildingbg{
  background-image: url("bldg.png");
  background-repeat: repeat-y
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  font-weight: 100;
  height: 100vh;
  margin: 0;
2
  • What I see they are identical. So why do you need 2 css? Commented Dec 31, 2017 at 10:59
  • @halojoy sorry about that, I try using .buildingbg for both pages and the main is working but the other pages are not showing anythin Commented Dec 31, 2017 at 11:01

1 Answer 1

1

The reason it is not working is you are using page relative paths in your CSS.

It works on your home page because that is the site root. As you visit /page or some other page, because you are using page relative paths it will look for the image in the /page directory.

If it is working on your homepage, I am assuming you dropped bldg.png straight in the public/ directory, so simply add a slash in front to use site relative image paths.

 background-image: url("/bldg.png");

You should organize your images into a folder within the public directory though.

Sign up to request clarification or add additional context in comments.

3 Comments

Its still not working thou with the page i tried putting it in public and in image folder background-image: url("images/bldg.png");
You are still making page relative paths. Prefix that path with / (/images/bldg.png)
oh THANKS GOT IT MAN

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.