CSS Flashcards

1
Q

What are block elements, and how do they behave in terms of placement and height?

A

Block elements occupy full horizontal space within their parent and stack vertically. Their height usually depends on their content. Examples include p, div, and section.

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

What are inline elements, and how are they placed on the page?

A

Inline elements flow left-to-right horizontally Examples are span, em, a, and single letters.

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

Inheritance of Rules

Do CSS rules for parent elements apply to their children?

A

Yes, a CSS rule for a parent element automatically matches its children. For instance, a rule for the body will apply to all text inside or outside <p> tags.

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

Efficient Styling

How does inheritance help in writing efficient styles?

A

Inheritance allows you to apply styles to parent elements and have those styles automatically affect their children.

This reduces the need to write repetitive rules for every individual element.

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

What does the media attribute indicate in the <style> tag?

A

The media attribute indicates the target media types/devices for which the CSS rules.

Used to specify that the style is for special devices (like iPhone), screen, speech or print media.

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

What methods can be used to change the appearance of HTML elements using CSS?

A

Three basic methods for adding code to HTML elements:
* Write it directly within the element’s tag. (inline)
* Place it in a separate section of the page’s source code. (section)
* Store it in an external file and reference it in the HTML page. (external)

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

Why is it not recommended to use the style attribute of the <p> tag if there are sibling paragraphs that should look the same?

A

The CSS declaration will need to be replicated in the other <p> tags, which is time consuming, increases the file size, and it is prone to errors.

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

What is the default placement policy for placing a div element?

A

The div element is treated as a block element by default, so it will occupy all the horizontal space of its parent element and its height will depend on its contents.

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

What attribute of the <link> tag indicates the location of an external CSS file?

A

The href attribute.

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

What is the correct section to insert the link element inside an HTML document?

A

The link element should be in the head section of the HTML document.

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

What happens if you start a comment with /* in the middle of a CSS file, but forget to close it with */?

A

All the rules after the comment will be ignored by the browser.

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

The default way the browser renders the document tree is called?

A

normal flow

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

True or False?
The basic element flow is from top to bottom and left to right.

A

True

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

True of false
Normal flow is simple and sequential.

A

True

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

What happens to automatic margins in a floated box?

A

Automatic margins are ignored in a floated box.

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

What is the purpose of the float property in CSS?

A

The float property is used to remove an element from the normal flow and make it float over other block elements.

17
Q
A