answersLogoWhite

0

Which is the correct CSS syntax?

Updated: 8/9/2023
User Avatar

Wiki User

14y ago

Best Answer

There are many places to learn the correct syntactical parts of the standard which is now CSS 2.1, and CSS 3.0 in the wings. Whole books are dedicated to this subject. I have one that site that uses nothing but version 1.0, but they will degrade gracefully down to internet Explorer 3, Netscape Navigator 2.02 and pre-Opera 3.6 Links are attached.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

8y ago

CSS, regardless of if you are using it in as part of inline styles, embedded styles, external styles, or imported styles, uses the same syntax. The syntax for a CSS rule is comprised of a selector and declarations. CSS declarations sit inside curly brackets and are comprised of two parts: a property and a value. The following is a valid CSS rule.

p {

font-family: Arial;

color: #FFFF00;

}

You'll notice the letter p sitting outside of the curly brackets. This is the selector. This rule targets all paragraph elements in an HTML document. Next come the curly brackets inside of which I have two rules, font-family: Arial; and color: #FFFF00;. The text before the colon is the property name (in this case, font-family and color are the properties we are changing) and the part that is after the colon is the value for that property (in this case, Arial is the value we are setting for the font-family property and the hexadecimal color #FFFF00 [yellow] for the color property). All CSS rules should end in a semi-colon.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

selector {

property:value;

}

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

Insert the following syntax into your CSS Stylesheet:

Body {

background-color:#FFFFFF;

}

This just an example, you can replace FFFFFF with any color.

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

CSS does not have any one syntax. It could be used in three different ways according to use.

This answer is:
User Avatar

User Avatar

Anonymous

Lvl 1
3y ago

Style=“width:20px

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which is the correct CSS syntax?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Is the colon a valid example of CSS syntax?

No, a single colon in itself is not a valid example of CSS syntax.


Why does a css class not work in fire fox?

CSS classes do work in FireFox. What is the main problem? (specifically)Have you checked that the syntax is correct?There is a lot to learn about things with CSS and browsers, you may need a hack or fix, if all else fails.


Which of the following is the correct syntax for HTML Anchor Control?

linktest


How do you create a bat file with correct syntax?

program it right


What is the correct syntax for URL?

scheme://domain:port/path?query_string#fragment_id

Related questions

Is the colon a valid example of CSS syntax?

No, a single colon in itself is not a valid example of CSS syntax.


What is the correct CSS syntax for making all the elements bold?

p { font-weight: bold; /* font-weight: 700; does the same */ }


Why does a css class not work in fire fox?

CSS classes do work in FireFox. What is the main problem? (specifically)Have you checked that the syntax is correct?There is a lot to learn about things with CSS and browsers, you may need a hack or fix, if all else fails.


What is the correct CSS syntax for making all the p elements bold?

p { font-weight: bold; }


What is the syntax of a programming language and what are the primary goals of syntax analysis?

Well, syntax is the fancy name for programming code. Without syntax, you wouldn't really have a program. It's good to analyze syntax as you are making sure that it is correct. If it isn't correct, then it won't work.


Which websites allow you access to free menu templates?

Daily syntax is a website where free menu templates can be found in CSS. Also this can be found on CSS menu market and in tutorials how to run a cafe/restaurant.


Is this sentence correct- Are you based in Canada?

The syntax is correct - it may or may not be true.


Explain fontsize and color in context of css?

Well, font-size and color are normally initially defined in the "body" element of the stylesheet. They can be elementally redefined for separate elements in the same place. Understand the necessity of hyphens and correct naming. Syntax is critical.


Which of the following functions is written in the correct syntax?

NOW


Which of the following is the correct syntax for HTML Anchor Control?

linktest


How do you create a bat file with correct syntax?

program it right


What is the correct syntax for declaring and initializing an array that contains the numers 0-9?

The syntax is: int a[10]; for (int i=0; i<10; ++i) a[i]=i;