• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Expected LBRACE at Line 1 col 2

Explorer ,
Nov 29, 2019 Nov 29, 2019

Copy link to clipboard

Copied

Hi,

 

I am trying to write something to my main.css and I am getting the above error message.  Can anyone help me and the code in question is as follows

 

@Font-face {
	font-family: 'HeyAlice' cursive;
	src: url("../fonts/HeyAlice-Regular.otf");
}

It is at the very top of the CSS.  Is that the correct place for it? 

TOPICS
Code , Error

Views

7.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Dec 02, 2019 Dec 02, 2019

I have had a friend who is a web developer down in Devon, UK, help me with it and between us, we have got it sorted.  Apparently there were 3 weird characters at the start when he looked at the CSS through a HexViewer.

Votes

Translate

Translate
LEGEND ,
Nov 29, 2019 Nov 29, 2019

Copy link to clipboard

Copied

Normally you would insert a comma after the font-family like below:

@font-face {
	font-family: 'HeyAlice', cursive;
	src: url("../fonts/HeyAlice-Regular.otf");
}

 

However its just possibly that Dreamweaver does not understand @font-face {} and so throws a warning/error.

Linting is NOT totally reliable, often a warning or error is reported when there is not one.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2019 Nov 29, 2019

Copy link to clipboard

Copied

@font-face throws no errors for me.  I think the comma is what's missing.

 

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 29, 2019 Nov 29, 2019

Copy link to clipboard

Copied

I saw that and corrected it.  I still am getting the error.

 

@font-face {
	font-family: 'HeyAlice', cursive;
	src: url("../fonts/HeyAlice-Regular.otf");
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2019 Nov 29, 2019

Copy link to clipboard

Copied

I think the error is probably caused by something else in your code.

Use the online validation service.

https://jigsaw.w3.org/css-validator/

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 29, 2019 Nov 29, 2019

Copy link to clipboard

Copied

Okay, now I'm totally baffled.  It likes my CSS, apart from the webkit stuff, but the '@font-face' business, it doesn't see an error.  Does this mean that the LBRACE error is a bug? Or should I be worried about it?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 30, 2019 Nov 30, 2019

Copy link to clipboard

Copied

If the code works when tested on all devices and browsers, don't worry about the alleged error.  Code linting is what it is.  It's not perfect.

 

 

 

 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

The error you are seeing is often caused by something in your code confusing DW's near useless Linter into marking lines of code that are otherwise fine. For example: having the odacity to use the fr unit when working with CSS Grid will throw that error.

Turn Linting off in your preferences and use the online resources like https://jigsaw.w3.org/css-validator/ for CSS validation and https://validator.w3.org/nu/ for HTML.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

LATEST

I have had a friend who is a web developer down in Devon, UK, help me with it and between us, we have got it sorted.  Apparently there were 3 weird characters at the start when he looked at the CSS through a HexViewer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines