Trying to Create URL background

Trying to Create URL background
0

#1

On the Applied Visual Design - Create Texture by Adding a Subtle Pattern as a Background Image page it asks to create a background with a URL. I’m entering it under the body selector (like it tells me too) as background: url(https://i.imgur.com/MJAkxbh.png); and it is not going through. What am I missing?


#2

Hi there, you need to include the URL in quotation marks in order to work. For example: url(“link goes in here”);


#3

Thanks, I missed this one too! Confusion set in because the pattern showed up in the window… made it look correct.


#5

So, my question is, why the use of quotation marks if it works without them? Is it just for consistency?


#6

Hi. I am not sure it works without the quotation marks. Does it really work?


#7

Tried it out on Codepen.io and it works there without quotes:
URL background


#8

Per the W3C, quotes are optional. However, the exception to this is the following:

Some characters appearing in an unquoted URI, such as parentheses, white space characters, single quotes (’) and double quotes ("), must be escaped with a backslash so that the resulting URI value is a URI token: ‘(’, ‘)’.

I think for this exercise on freecodecamp, they want you to use quotes as a best practice.


#9

Probably. I always use quotation marks though when it comes to URLs