1

I've included code from the index.html and style.css pages are linked correctly as other elements are all working fine.

.fullbox {
  border: 1px solid orange;
  background-image: url(background-image:url(/images/topmain.jpg) no-repeat;
}
<div class="row">
  <div class="col-12">
    <div class="fullbox">
      <h2>plumbing</h2>
    </div>
  </div>
</div>

2
  • Are you getting any error messages in Developer tools? Are you sure the URL to the image is correct? Commented Jul 7, 2018 at 12:33
  • you did somehow a bad copy/paste Commented Jul 7, 2018 at 12:36

3 Answers 3

1

You have mistaken CSS here

background-image: url(background-image:url(/images/topmain.jpg) no-repeat;

It should be

background-image: url('images/topmain.jpg');
background-repeat: no-repeat;

OR

background: url(/images/topmain.jpg) no-repeat;

Update in your snippet

.fullbox {
  border: 1px solid orange;
  background-image: url('images/topmain.jpg');
  background-repeat: no-repeat;
}
<div class="row">
  <div class="col-12">
    <div class="fullbox">
      <h2>plumbing</h2>
    </div>
  </div>
</div>

Another live example

.fullbox {
  border: 1px solid orange;
  background-image: url('https://cdn.dribbble.com/users/1928643/avatars/small/b3f1a5ea4d68ff539b8f808ff3c4b8a5.jpg');
  background-repeat: no-repeat;
}
<div class="row">
  <div class="col-12">
    <div class="fullbox">
      <h2>plumbing</h2>
    </div>
  </div>
</div>

To learn more about background-image property and path

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

1 Comment

Embarrassing Mistake.
0

background: url(/images/topmain.jpg) no-repeat; }

Comments

0

background: url(source/...) center center/cover no-repeat fixed;1)you can not use no-repeat in background-image , instead you should use JUST background syntax. e.g 2) after url no need to write background-image again, you can just go ahead and give your relative address , e.g background-image: url(source/...) hope it helps :)

1 Comment

Thanks for your reply. It's was helpful.

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.