2

Example directly from my CSS file:

@import 'https://fonts.googleapis.com/css?family=Lato:700';
@import url('https://fonts.googleapis.com/css?family=Montserrat:700');

I purchased a beautiful theme for my WordPress site and some of the CSS fonts are imported like that. I am combining all these, and I'm just not sure of the difference.

I did some research and notice that Mozilla also flips between the 2 in their examples.

2 Answers 2

3

From W3 specification:

The following lines are equivalent in meaning and illustrate both '@import' syntaxes (one with "url()" and one with a bare string):

@import "mystyle.css";
@import url("mystyle.css");

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

Comments

0

Both ways are correct and they are equivalent.

This is a quote from W3C: Cascading Style Sheets (CSS) — The Official Definition:

The syntax of @import is:

@import [ <url> | <string> ] <media-query-list>? ;

Where the <url> or <string> gives the URL of the style sheet to be imported, and the optional <media-query-list> (the import conditions) states the conditions under which it applies.

If a <string> is provided, it must be interpreted as a url with the same value.

Comments

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.