answersLogoWhite

0


Best Answer

The three primary parts of a CSS definition are:

selector{property:value;}

The selector can be one of three things or a combination of the three. These are element (such as <div> or <img />), id (#), and class (.).

The property can be a number of rules ('background', color, font-weight). A good place to reference these is w3schools.org.

The value is specific to the property. For example, if the selector is 'color', value could be 'red' or '#ccc', but it couldn't be 'bold'.

User Avatar

Wiki User

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

Wiki User

8y ago

The three parts to a CSS rule statement are the selector, the property, and the value. Here is are several examples of CSS rules.

h1 { color: #FFCC00; }

.tv-show { color: #3984BD; }

#copyright { color: #9CBDDE; }

Each of these examples contain all three parts of a CSS rule statement. In this example, the selector is h1, .tv-show, and #copyright. The h1 selector targets all level 1 headings, the .tv-show is a class selector that applies everytime the class="tv-show" is used in HTML, and the #copyright is an ID selector that applies to the unique identifier id="copyright" in an HTML document.

In all three cases, I used the same CSS property, the color property to alter the color. The final part is the value. In each of the three cases I used a hexadecimal color value as the value for the color property.

You'll notice that in each of my CSS rule statements that the property and value are separated by a colon (:) and that after the value I have a semi-colon (;). The colon separating the property and the value is required. The use of the semi-colon is recommended when you have a single rule defined, but if you have multiple rule declarations in a single declaration block then it is required. Finally, you'll also notice that my property/value pairs are located inside a set of curly brackets ( { } ). This is also required syntax when declaring CSS rules in external or embedded style sheets.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the three primary parts of a CSS definition?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are two way to change value of a css property?

There are not two but three ways to change. Inline, Internal and External CSS are three ways of changing CSS.


What are three aspects that can be controlled by CSS?

CSS can be integrated in three ways: Inline: Style attribute can be used to have CSS applied HTML elements. Embedded: The Head element can have a Style element within which the code can be placed. Linked/ Imported: CSS can be placed in an external file and linked via link element.


Why are warning labels on Css?

Answer 1: You're question must not be related to Cascading Stle Sheets as I have never seen a warning label on a CSS file. :P Answer 2: Your browser does not support CSS, or supports only limited functions of CSS or you have it switched off in your browser. Rely: There probably isn't that many browsers being used today that do not support CSS. Only some parts of the CSS is not supported in IE 6/7. Rest are either compliant or non-compliant:


What are the types of style sheets?

CSS is CSS. Three methods in order of preference and precedence are:External CSS fileEmbedded CSS using the style tags placed between the head tags of the HTML page.Inline CSS used inside an HTML tag.Types could refer to ones that can be made specifically for media, print, screen, etc. See list of media types in related links.


What two parts does a CSS style definition contain?

A property and a value., separated by a semi-colon. In the following example, color is the property and red is the value. They are being applied to all text enclosed in p tags. The p is known as a selector. p {color:red}

Related questions

What are two way to change value of a css property?

There are not two but three ways to change. Inline, Internal and External CSS are three ways of changing CSS.


What is the definition for a relative address in CSS?

Relative addresses exist on servers and in HTML. A webpage can have a relative address linking a stylesheet to it. They do not exist in CSS.


What are three aspects that can be controlled by CSS?

CSS can be integrated in three ways: Inline: Style attribute can be used to have CSS applied HTML elements. Embedded: The Head element can have a Style element within which the code can be placed. Linked/ Imported: CSS can be placed in an external file and linked via link element.


How do you get css to work?

CSS can be applied to a web page in three ways: inline style, a STYLE element in the HEAD of a page, or an external style sheet (or any combination of the three).CSS rule use a selector to determine which elements to apply the styling to and property:value rules to determine which styles to apply.


What is css and deffrent type of css?

css


Why are warning labels on Css?

Answer 1: You're question must not be related to Cascading Stle Sheets as I have never seen a warning label on a CSS file. :P Answer 2: Your browser does not support CSS, or supports only limited functions of CSS or you have it switched off in your browser. Rely: There probably isn't that many browsers being used today that do not support CSS. Only some parts of the CSS is not supported in IE 6/7. Rest are either compliant or non-compliant:


What are the types of style sheets?

CSS is CSS. Three methods in order of preference and precedence are:External CSS fileEmbedded CSS using the style tags placed between the head tags of the HTML page.Inline CSS used inside an HTML tag.Types could refer to ones that can be made specifically for media, print, screen, etc. See list of media types in related links.


What two parts does a CSS style definition contain?

A property and a value., separated by a semi-colon. In the following example, color is the property and red is the value. They are being applied to all text enclosed in p tags. The p is known as a selector. p {color:red}


What is valid css?

Valid CSS is CSS that has been run through the W3C CSS checker and passed.


What is css php?

There is no such thing. PHP is a scripting language, and CSS is a markup protocol. While the two technologies are often used as different parts of the same web application, they are not mutually inclusive and are not part of the same specification.


What are selectors in CSS?

When you are writing CSS (Cascading Style Sheet) code, you are writing a set of rules that a page's HTML code must follow when rendering the page. Every block of CSS rules has three important parts: The selector, properties, and values. The selector is what tells the page WHAT elements the following rules apply to, such as all divs with a name of "colorMeRed". Properties are what the page must change on the element, such as it's color. Finally, the value is what that property actually must be set to, such as "red".


How do you make CSS layouts?

CSS layouts can be created in an external CSS file. The extension of the file should be CSS only.