0

What is wrong with my code? I am using a PHP file for header and then I am including it where is needed.

This is the CSS I have:

header {
    margin-top:0;
    height: 200px;
    background-image: url("slike/dekorativni.jpg");
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
 }

When I set the background to some color it is showing colored background but image won't show.

Is it OK to put !DOCTYPE HTML in a PHP file inside an echo?

15
  • 2
    If background color works, are you 100% positive that image exists exactly where you think it does? that path his relative to the css file. Commented May 31, 2017 at 13:32
  • Are you using background-color or background? Commented May 31, 2017 at 13:34
  • 3
    why the php tag? there's only css here. Edit: to which that was removed in an edit. Commented May 31, 2017 at 13:34
  • 1
    Maybe header is a class, so .header? Commented May 31, 2017 at 13:35
  • I have removed the php tag add it back when you have a coding that have to do with php Commented May 31, 2017 at 13:35

1 Answer 1

0

Try to change to Relative URLs. It may happen that your included file is not loading the css or the image path after including is not working. If you use Relative URL to the image path it must work. Please check also if your css is being load in the included file, check if fonts and other formats are working.

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

1 Comment

i reorganize everything and now is working, i am guessing that problem was with image path or name i am not sure.

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.