CSS - Cascading Style Sheets
Chapter 13 · Tamil Nadu State Board
- 6 min read
- 5-question quiz
Every key point below shows the sentence from your textbook it comes from. Book back answers are solved and checked against the book; answers we could not prove are left out. How we check content
In short
This lesson teaches how CSS controls the appearance of HTML content. It explains internal, inline, and external styles, with a focus on external CSS files that can be reused across web pages. Students learn how CSS rules use selectors, properties, and values, and how to link a CSS file to HTML. CSS matters because it helps make web page styles easier to maintain and understand.
Written by AI from this lesson. How we check it
Key points
- An internal style sheet changes how a tag appears throughout one HTML document.
From your textbook
“A style tag is used to change the default characteristics of a particular tag inthe entire web document”
- An external style sheet stores style information separately so it can be used on multiple pages.
From your textbook
“These separate style files are known as “Sitewide Style sheets” or “External Style Sheets”.”
- CSS can control text, spacing, borders, backgrounds, and other visual effects on a web page.
From your textbook
“Using CSS, you can control the font colour, font style, spacing between pages, columns size, border colour, background image or colour”
- Using CSS can make web page styles easier to maintain and reuse.
From your textbook
“The styles defined in CSS can be reused in multiple HTML pages.”
- A CSS rule has a selector and a declaration block, where properties and values are separated by a colon.
From your textbook
“The property name and its value should be separated by a colon.”
- The link tag connects an HTML document to a CSS file, with href naming the file.
From your textbook
“The href attribute is used to link the .css file.”
Formulas in this chapter
- CSS rule patternHTML Tag { Property : Value; }Explained here
- Link tag pattern<Link rel = "stylesheet" type = "text/css" href = CSS_File_Name_with_Extension>Explained here
- CSS comment pattern/*.....this is a comment in style sheet.....*/Explained here
- General CSS ruleselector { property: value; }Explained here
CSS and the three ways to apply styles
Definition
- Cascading Style Sheets (CSS)
- CSS is a style sheet language used to describe the formatting of an HTML document.
CSS can control text colour and style, spacing, column size, borders, backgrounds and other page effects. Style details can be stored in a separate file with the extension .css and used by web pages.
Ways to apply CSS styles
| Style method | Where it applies |
|---|---|
| Internal style sheet | Defined with the <style> tag and applies within one HTML document. |
| External style sheet | Stored in a separate file and can be used by multiple HTML pages. |
| Inline style | Defined for a particular tag in the HTML document and applies only where it is written. |
The <style> tag can change the default appearance of a tag wherever it appears in one document. Professional web developers do not use internal styles.
CSS rules and formatting properties
Definition
- Selector
- A selector refers to the HTML tag that should receive the styles.
Definition
- Declaration
- A declaration is the style code placed inside curly braces after a selector.
A declaration can contain several properties. Separate each property and value with a colon, and end each property with a semicolon.
HTML Tag { Property : Value; }
The HTML tag is the selector. The property names the style setting, and the value sets how it appears.
Common formatting properties
- color sets text colour, such as P { color:pink; }.
- text-align sets alignment to Center, Left, Right or Justify.
- font-family sets the font type.
- font-style can be Normal or Italic.
- font-weight can be Normal or Bold.
- font-size sets the size in pixels.
- background-color sets a background colour.
- border can set border thickness, style and colour, such as H2 { border : 2px solid red; }.
- background-image sets an image using a URL; background-repeat and background-position can also be set.
- Margin-top, Margin-bottom, Margin-left and Margin-right set paragraph margins.
HTML supports nearly 140 color names. A style sheet can include several rules, with each selector setting styles for its HTML tag.
Creating and linking an external style sheet
Create a CSS file
- Open an empty notepad.
- Type the style properties and their values.
- Save the file with the extension .css.
Use the <link> tag in the HTML head section to connect an external CSS file. Include rel="stylesheet" and type="text/css". Set href to the CSS file name and extension.
<Link rel = "stylesheet" type = "text/css" href = CSS_File_Name_with_Extension>
The href attribute identifies the CSS file to link to the HTML page.
For example, mystyle.css can define styles for H1 and P. An HTML page can link to mystyle.css in its head section, and those styles then format its H1 and P content.
A CSS rule can also set a page background, such as body { background-color : pink; }. The linked CSS file supplies that background style to the HTML page.
Benefits and comments in CSS
Advantages of CSS
- Maintainability: Separate CSS files make it easier to change and maintain a web page's appearance.
- Reusability: Styles can be reused in multiple HTML pages.
- Easy to understand: Style specifications help keep page tags well organized.
CSS was invented by HakonWium Lie on October ,10 1994. It is maintained through a group of people within the W3C called the CSS Working Group.
Definition
- CSS comment
- A comment is extra text in a style sheet written between /* and */.
/*.....this is a comment in style sheet.....*/
The text between /* and */ is a comment in the style sheet.
Remember: Use an external .css file when the same styles need to format multiple HTML pages.
CSS Basics
Definition
- CSS
- CSS stands for Cascading Style Sheets and is used to set the appearance of HTML elements.
Definition
- Style Sheet
- A separate file that contains the style of appearance.
Definition
- Selector
- An HTML element that identifies which element a CSS rule will style.
Definition
- Property
- An attribute of an HTML tag.
Definition
- Link
- A connection with another file.
The extension of a CSS file is .css. The <style> tag is used to write page-level style. CSS may also be called Internal Style Sheets.
CSS Rules and Declarations
A CSS rule has a selector followed by a declaration block. The declaration block is enclosed in { }. Each declaration gives a property and its value, separated by a colon. End a declaration with a semicolon.
selector { property: value; }
selector identifies the HTML element; property is the style attribute; value sets that style.
Worked example
Write a CSS rule to set paragraph text to red and centre it.
Try it first, then show the solutionSolution
- Use p as the selector.
- Set color to red and text-align to center inside the braces.
- End each declaration with a semicolon.
Answer: p {color:red; text-align:center;}
CSS Font and Text Properties
Properties named in the questions
- Font-Weight sets how bold the text is.
- Font type, font style and font size can be set for an HTML element.
- Color sets the text color.
- Text alignment can be set for an HTML element.
Worked example
Write a CSS rule to set the font type, style and size of an h1 element.
Try it first, then show the solutionSolution
- Use h1 as the selector.
- Add declarations for the font type, font style and font size.
Answer: h1 {font-family: font type; font-style: font style; font-size: font size;}
Applying CSS to a Paragraph
A paragraph can be styled with a CSS rule that uses p as its selector. The requested appearance can include font name, bold italics and color. These properties are placed in the declaration block.
Worked example
Style the given paragraph with Cooper Black font, bold italics and blue color.
Try it first, then show the solutionSolution
- Use p as the selector.
- Set the font family to Cooper Black.
- Set the font style to italic, the font weight to bold, and the color to blue.
Answer: p {font-family: Cooper Black; font-style: italic; font-weight: bold; color: blue;}
Remember: A CSS rule uses braces around its declarations, a colon between each property and value, and a semicolon after each declaration.
Questions students ask
Short, direct answers to what students search for in this chapter.
What is CSS?
CSS, or Cascading Style Sheets, is a style sheet language used to describe the formatting of an HTML document. It can control text colour and style, spacing, borders, backgrounds and other page effects. CSS styles can be kept in a separate .css file.
What is the difference between internal and external style sheets?
An internal style sheet is defined with the <style> tag and applies within one HTML document. An external style sheet is stored in a separate .css file and can be linked to multiple HTML pages. This lets the same styles be reused across pages.
How do you link a CSS file to an HTML page?
Place a <link> tag in the HTML head section. Include rel="stylesheet" and type="text/css", then use the href attribute to name the CSS file with its extension. The linked file contains the styles used to format the HTML page.
What are the advantages of CSS?
CSS supports maintainability because separate style files make appearance changes easier. It supports reusability because styles can be used in multiple HTML pages. It also makes pages easier to understand by keeping style specifications organized with the page tags.
How do you write a comment in CSS?
Write the comment between /* and */ in the style sheet. For example: /*.....this is a comment in style sheet.....*/. This lets you add extra comments in a style sheet block.
What does CSS stand for?
CSS stands for Cascading Style Sheets. It is used to define the appearance of HTML elements. CSS rules use a selector to identify an element and declarations to set its style properties and values.
Show 3 more questions
What is the general format of a CSS rule?
The general format is selector { property: value; }. The selector identifies the HTML element. Inside the braces, each declaration gives a property and value, separated by a colon and terminated with a semicolon.
What is the extension of a CSS file?
A CSS file uses the .css extension. A separate style sheet file can contain appearance rules, which can be connected with another file.
Which CSS property makes text bold?
Font-Weight is the property used to make text bold. In a CSS declaration, write the property followed by a colon and its value, such as font-weight: bold;.
Book back answers
20 textbook exercises, solved and checked against the book. Questions we could not prove are left out.
Choose the correct answer
Expansion of CSS
- (A) Cascading Style Schools
- (B) Cascading Style Scheme
- (C) Cascading Style Sheets
- (D) Cascading Style Shares
Try it, then show the answerAnswer
(C) Cascading Style Sheets
The chapter expands CSS as Cascading Style Sheets.
From the book: “Cascading Style Sheets (CSS) are also called as Sitewide Style sheets”
Which of the following is the page level style?
- (A) <Page>
- (B) <Style>
- (C) <Link>
- (D) <H>
Try it, then show the answerAnswer
(B) <Style>
The chapter identifies the <style> tag as a page-level or internal style sheet.
From the book: “The “Internal Style sheet” is defined and implemented only within an HTML document.”
CSS is also called as:
- (A) Sitewide Style Sheets
- (B) Internal Style Sheets
- (C) Inline Style Sheets
- (D) Internal Inline Sheets
Try it, then show the answerAnswer
(A) Sitewide Style Sheets
CSS is described as sitewide style sheets or external style.
From the book: “Cascading Style Sheets (CSS) are also called as Sitewide Style sheets or external style.”
The extension of CSS file is
- (A) .ssc
- (B) .css
- (C) .csc
- (D) .htm
Try it, then show the answerAnswer
(B) .css
Separate CSS style files are saved with the .css extension.
From the book: “The separate file should be saved with the extension .css”
Practice
What does a CSS selector identify?
Exam questions
Practice questions with model answers. These are not from an official paper.
What is CSS, and name two things it can control on a web page.2 marks
CSS is a style sheet language used to describe the formatting of an HTML document. It can control features such as font colour and background colour.
State two advantages of using CSS.2 marks
CSS makes styles easier to maintain, as style information is stored separately. Styles can also be reused in multiple HTML pages.
Describe the parts of a CSS rule and how its properties and values are written.5 marks
A CSS rule has a selector and a declaration. The selector identifies the HTML tag to style, and the declaration contains style definitions within curly braces. A property and its value are separated by a colon, and declarations are separated and ended with semicolons.
How is an external CSS file linked to an HTML document?2 marks
Place a link tag in the head section. Include rel="stylesheet" and type="text/css", and use the href attribute to specify the CSS file name.
Watch out
- Do not confuse internal styles, which apply within one HTML document, with external styles, which are stored separately.
- Do not mix up a property and its value: they are separated by a colon, while declarations end with semicolons.
Still stuck on this lesson?
Get an AI answer grounded in your actual textbook — with the exact page reference.
Ask AI about this topic →