-2
#hero {
    background: url('/wp-content/themes/bootstrap2wordpress/assets/img/hero-bg.jpg') 50% 0 repeat
}

Here is my code but still doesn't work

3
  • share the site url Commented Nov 9, 2017 at 4:40
  • Could you clarify what you mean by fix? Just a normal background image? or fixed background image (paralax effect)? Commented Nov 9, 2017 at 5:13
  • Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. See: minimal reproducible example Commented Nov 9, 2017 at 5:16

4 Answers 4

0

Without more information (some HTML to go with it) or a webpage you are having trouble with, it is very hard to understand what you are trying to accomplish.

I would try something like this, as it sounds like you are trying to have the background image repeat.

hero {
background: url('/wp-content/themes/bootstrap2wordpress/assets/img/hero-bg.jpg') repeat;
}

https://www.w3schools.com/cssref/css3_pr_background.asp

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

Comments

0

Try this, But you need to add this to your header.php or any PHP file header section. This will not work in CSS file.For more details visit URL

<style>
   .hero {
    background-image: url("<?php echo content_url(); ?>/wp-content/themes/bootstrap2wordpress/assets/img/hero-bg.jpg") 50% 0 repeat;
  }
</style>

Hope this will help you.

Comments

0

Just navigate up a directory or two using ../

hero {
  background: url('../../img/hero-bg.jpg') repeat;
}

Comments

0

I am assuming hero is your class name thats why prefixed with .

In your code I could not find . , so check the same one more time.This also can be one issue if it is not there in your code.

Can you try this way:

    .hero {
    background: url('/wp-content/themes/bootstrap2wordpress/assets/img/hero-bg.jpg');
    background-size: 50% 0;
    background-repeat: repeat;
}

Comments

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.