Which of the below is the correct way to set a background image?

Options
- body {background-image:url(paper.gif);}
- body {background-image:url('paper.gif')};
- body {background-image:url('paper.gif')}
- body {background-image:url('paper.gif');}


CORRECT ANSWER : body {background-image:url('paper.gif');}

Discussion Board
Usage of apostrophes or quotation marks before and after the file name

The file name (paper.gif) can be coded with or without the usage of apostrophes. The W3C CSS validator accepts files with or without apostrophes/quotation marks.
Apostrophes/quotation marks should be used in conjunction with file path or file names with embedded blanks.

G. Tsang 03-16-2014 02:48 PM

w3c Standards on last line needing a semi-colon

I would look at how the syntax is written and if there is a need for ";" at the end of this answer. There is no need for a single line and/or the last line to have a semi-colon according to the w3c.

Gregory F Phillips 11-9-2013 09:27 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement