CSS Text and Border Color

GiftedCornett avatar
GiftedCornett
·
·
Download

Start Quiz

Study Flashcards

24 Questions

What is the main purpose of using CSS?

To define styles for your web pages, including the design and layout

What is the CSS syntax to select HTML elements based on the element name?

Using the element name as a selector

What is the purpose of the CSS id selector?

To select a specific HTML element based on its id

What is the correct syntax to write a CSS comment?

/* This is a comment */

What is the CSS property to change the text color of an HTML element?

color

What is the purpose of the CSS declaration block?

To contain one or more CSS declarations separated by semicolons

What is the correct CSS syntax to set the background color of the body element to light blue?

body { background-color: lightblue };

What is the CSS property to set the alignment of text to the center?

text-align

What is the purpose of the background-color property in CSS?

To specify the background color of an element

What is the format of an RGB color value in CSS?

rgb(red, green, blue)

What is the purpose of the alpha parameter in an RGBA color value?

To specify the opacity of the color

What is the default value of the red parameter in an RGB color value?

0

What is the HEX equivalent of the RGB color value rgb(255, 99, 71)?

#ff6347

What is the purpose of the rgba function in CSS?

To set the opacity of a color

What is the range of values for the red, green, and blue parameters in an RGB color value?

0 to 255

What is the difference between an RGB color value and an RGBA color value?

RGBA has an additional alpha parameter

What has the highest priority in CSS, and will override external and internal styles and browser defaults?

Inline style

Where do you place CSS comments in the code?

Anywhere in the code

What is the purpose of CSS comments?

To explain the code

How do you specify colors in CSS?

Using predefined color names, RGB, HEX, RGBA values

What is the purpose of the CSS background color property?

To set the background color

What happens if an internal style is defined before the link to the external style sheet?

The internal style is used

What is the correct way to write a CSS comment?

/* This is a comment */

What is the purpose of CSS styles?

To style HTML elements

Study Notes

CSS Basics

  • CSS is used to style an HTML document, describing how HTML elements should be displayed.
  • CSS is essential for defining styles for web pages, including design, layout, and variations in display for different devices and screen sizes.

CSS Syntax

  • A CSS selector points to the HTML element you want to style.
  • The declaration block contains one or more declarations separated by semicolons.
  • Each declaration includes a CSS property name and a value, separated by a colon.
  • Multiple CSS declarations are separated with semicolons, and declaration blocks are surrounded by curly braces.

CSS Selectors

  • CSS selectors are used to "find" (or select) the HTML elements you want to style.
  • The CSS element selector selects HTML elements based on the element name.
  • The CSS id selector uses the id attribute of an HTML element to select a specific element.

CSS Text and Border Colors

  • You can set the color of text using the color property.
  • You can set the color of borders using the border-color property.

CSS Color Values

  • Colors can be specified using color names, RGB values, HEX values, HSL values, RGBA values, and HSLA values.
  • RGB color values represent RED, GREEN, and BLUE light sources.
  • RGBA color values are an extension of RGB color values with an alpha channel, which specifies the opacity for a color.

CSS Backgrounds

  • The CSS background properties are used to add background effects for elements.
  • The background-color property specifies the background color of an element.

CSS Cascading Order

  • When there is more than one style specified for an HTML element, the styles will "cascade" into a new "virtual" style sheet by the following rules:
    • Inline style (inside an HTML element)
    • External and internal style sheets (in the head section)
    • Browser default
  • Inline style has the highest priority and will override external and internal styles and browser defaults.

CSS Comments

  • Comments are used to explain the code and may help when you edit the source code at a later date.
  • Comments are ignored by browsers.
  • A CSS comment is placed inside the `

Learn how to set text and border colors in CSS. This quiz covers the basics of CSS styling and formatting.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

CSS and HTML Styles Quiz
15 questions
CSS Fundamentals
8 questions

CSS Fundamentals

CrisperJubilation avatar
CrisperJubilation
CSS Selectors in Web Design
5 questions
Module 8: Using External CSS Quiz
6 questions
Use Quizgecko on...
Browser
Browser