background-image:no-repeat not working, syntax is correct

css, html

Solution

The syntax you should use is

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

.. or alternatively

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

if you prefer the short-hand syntax.

`background-image` always just defines an image file, so in your example, the second `background-image` rule is attempting to override the first one, but since "no-repeat" isn't a valid image file the browser just ignores it.

The various background properties are listed here for reference.

Problem

Below is the syntax I am using for the background Image. For some reason it is repeating on Y. I cannot use `overflow:hidden;` ``` <style> body { background-image: url('<?php echo $ActualPath; ?>images/backgroundimage.jpg'); background-image: no-repeat; } </style> ``` I want the background-image no-repeat on x and y.

Original source