Welcome To CSS - Css Rules & Selectors Flashcards

1
Q

CSS

A

Cascading Style Sheets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Cascading

A

(the way CSS applies one style on top of another)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Style sheets

A

control the look and feel of web documents

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Inline CSS

A

An online style enables a unique style to be applied to a single element.

In order to use an inline style, add the style attribute to the relevant tags.

Example:

<p>
This is an example of inline styling.
</p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Embedded/ Internal CSS

A

Internal styles are defined within the element inside the head section of an HTML page.

Example:

The following code styles all paragraphs…

<html> 
 <head> 
 <style> 
  p {
    color:white;
    background-color:gray; 
    }  

<p> This is my first paragraph. </p>

<p> This is my second paragraph. </p>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

External CSS

A

With this method, all styling rules are contained in a single text file, which is saved with the .css extension.

This CSS file is then referenced in the HTML using the tag. The element goes inside the head section.

The example:

HTML

<p> This is my first paragraph. </p>

<p> This is my second paragraph. </p>

<p> This is my third paragraph. </p>

CSS

P {
color: white;
background-color:gray;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

CSS Syntax

A

A style rule has three parts:selector,property, andvalue.

For example, the headline color can be defined as:
h1 { color: orange; }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Type Selectors

A

This selector targets element types on the page.

For example, to target all the paragraphs on the page:
p {
color: red;
font-size:130%;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

CSS Declarations

A

always end with a semicolon, and declaration groups are surrounded by curly braces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

id and class Selectors

A

id selectorsallow you to style an HTML element that has anidattribute, regardless of their position in the document tree. Here is an example of an id selector:

The HTML:<div><p> This paragraph is in the intro section.</p></div><p> This paragraph is not in the intro section.</p>
The CSS:
#intro {
color: white;
background-color: gray;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Descendant Selectors

A

These selectors are used to select elements that are descendants of another element. When selecting levels, you can select as many levels deep as you need to.

For example, to target only <em> elements in the first paragraph of the “intro” section:</em>

The HTML:<div><p class="first">This is a <em> paragraph.</em></p><p> This is the second paragraph. </p></div><p class="first"> This is not in the intro section.</p><p> The second paragraph is not in the intro section. </p>
The CSS:
#intro .first em {
color: pink; 
background-color:gray;
}

The descendant selector matches all elements that are descendants of a specified element.</em>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly