0

After looking many a solutions, none of that could resolve the issue i am in. Below is my code

<div style="height:210px; max-width: 100%; 
background-color: #e9ebee; background-position: center 50%; 
background-repeat: no-repeat; display: block; 
background-image: url('imagefromdb');"></div>

When inspecting element, I see background-image to be an invalid property. Now, for me, I could have accepted that if all images did not render. But the case is some images render, some does not.

I am rendering the images fetched from DB in a loop

j08691
  • 204,283
  • 31
  • 260
  • 272
  • How are you seeing it to be an invalid property? Is the path to the image correct? – j08691 Jun 22 '16 at 13:31
  • does the value `imagefromdb` exist in the file system or is the address reachable by your browser? – Martin Jun 22 '16 at 13:32
  • 2
    Possible duplicate of [Invalid Property Value on background-image](http://stackoverflow.com/questions/14378419/invalid-property-value-on-background-image) – Angel ofDemons Jun 22 '16 at 13:32
  • I can see nothing wrong with that code. Unless you can create a demo (where we can inspect through Dev console), I can't see a way to help you. – Harry Jun 22 '16 at 13:32
  • @AngelofDemons: No, this one doesn't have any other value specified for `background-image` property. – Harry Jun 22 '16 at 13:33
  • `background-position: center 50%; ` this is the same as `background-position: center;` – Martin Jun 22 '16 at 13:34
  • yes the path of the image is correct. it is basically a link like http://cdn.com/image.png , Also i have been through the links as mentioned but none did solve the problem. whats amazing is some images renders some doesnot, –  Jun 22 '16 at 13:36
  • Questions seeking code help must include the shortest code necessary to reproduce it **in the question itself** preferably in a [**Stack Snippet**](https://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/). See [**How to create a Minimal, Complete, and Verifiable example**](http://stackoverflow.com/help/mcve) – Paulie_D Jun 22 '16 at 13:37
  • 1
    If your image path contains a space it will not work as a background image. I would check your file names and either change them or encode the paths correctly. – Turnip Jun 23 '16 at 01:53

1 Answers1

0

if I understand your problem is that the color of background do not appear when you put an image it is because the image size and larger than men that the background

change this

" height : 210px ; to " height : 1210px ; 

and try

Boubaker
  • 427
  • 1
  • 7
  • 24