HTML & CSS Misc. Flashcards

1
Q

What is an element?

A

An element is what HTML is composed of. Elements structure a web page and define its content. A tag and the content between two tags is called an HTML element.

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

What is the body tag?

A

The body tag is an HTML element, and the content inside this element is what displays on the screen.

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

What is a child element?

A

A child element is an element contained inside another element, which is the parent element.

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

How many types of headings are there in HTML?

A

6 total (h1 through h6)

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

What is the div element?

A

The div element is a container that divides the page into sections. This helps group elements in the HTML together. Also, div stands for division.

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

What is an attribute?

A

Attributes are content added to the opening tag of an element. They can be used in different ways like providing information or changing styling.

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

What are attributes made out of?

A

The name of the attribute and the value of the attribute.

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

Which tags do you use to display text in HTML?

A

Paragraph tag or span tag

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

When is it best to use a span element vs. div element?

A

Use span when you want to target a specific piece of content that is inline.

Use div when you want to divide your content into blocks.

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

Do the image (img) and break (br) tags require end tags?

A

No

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

What attribute is required in an image tag?

A

source (src) attribute

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

What should you always include in image tags to help with assistive technologies?

A

An alt attribute that provides a description of the image.

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

Does the video tag require an end tag?

A

Yes

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

How do you link to other web pages in HTML?

A

By using an anchor element <a> which requires an href attribute. The element requires an end tag and content between the tags.</a>

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

What attribute can you use to open a link in a new window?

A

target attribute

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

How do you add comments to HTML?

A

Less than sign, exclamation point, dash, dash, your comment, dash, dash, and then greater than sign.

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

What are some ways you can help with accessibility on the web?

A
  • Ensure semantic HTML.
  • Set the language attribute on the open html tag. This help with screen readers.
  • Style with high-contrast and accessible fonts.
18
Q

What does the display property determine?

A

How an element’s box is rendered in the browser. Every HTML element is a box by default.

19
Q

What are the three display properties?

A

Inline, block, and inline-block

20
Q

How do you remove white-space between inline-block elements that are displaying side-by-side?

A

Add font-size: 0 to the parent element.

21
Q

What properties should you use when you want to horizontally center block-level content relative to a parent element?

A

display: block;
margin-left: auto;
margin-right: auto;

22
Q

What properties should you use when you want to horizontally center inline elements within a block element?

A

display: inline-block;

text-align: center;

23
Q

What does “a11y” stand for?

A

Web accessibility

24
Q

What is the position property?

A

The position property is about the flow of elements on HTML.

25
Q

What are the four most common values for the position property?

A

Static
Fixed
Relative
Absolute

26
Q

What is the static position?

A

It’s the normal flow or default flow. Block-level elements get rendered in the same order that they appear in the HTML markup. (Top to bottom and left to right)

27
Q

What is the fixed position?

A

An element will stay in place even when a user scrolls. However, you can’t have offset properties. (Left, right, top, or bottom) This a good choice for navigation bars and footers.

28
Q

What is the relative position?

A

An element is still in the normal flow, but we can use offset properties. (Left, right, top, and bottom)

29
Q

What is the absolute position?

A

They are elements that are outside of the normal flow and fixed, but they are offset in relation to the first parent container with a non-static position.

30
Q

What does the float property do in CSS?

A

The element is taken out of normal flow and pushed to where you set it. All other element next to it then wrap around it. This is good for wrapping text around an element.

31
Q

What attributes must the form element include and what do they mean?

A

Action: Determines where the form’s information goes. This is the URL of the server endpoint where the submitted form data should be sent to.

Method: Determines how the information is sent and processed. Usually, you’ll want method=”get” or method=”go”.

32
Q

What does the fieldset element do?

A

This element groups together related inputs and labels. These help web crawlers and screen readers to understand how inputs are grouped together. Only use it when grouping more than one input and not just one.

33
Q

what is the legend element?

A

It is like the title for the fieldset. This can add extra context for screen readers.

34
Q

What is the label element and what attribute must it have?

A

The label element explains what an input is for. It must have the “for” attribute that equals to the id of the input.

35
Q

Do labels and inputs require opening and closing tags?

A

Labels do but inputs don’t

36
Q

When would you use clear: right or clear: left in CSS?

A

When there is an element that does not recognize that the next element is an float element. Apply one of these to the element in CSS in order to have it move to the next line. Otherwise, it’ll stay on the same line as the float elements.

37
Q

How do you use the flexbox tools?

A

Use this property on the container in the CSS:

display: flex;

38
Q

What three properties control a flex container?

A

flex-direction
justify-content
align-items

39
Q

What is flex-direction and its values?

A

Flex-direction describes the main axis of the container, that is, whether items are laid out horizontally in a row or vertically in a column.

flex-direction accepts 4 possible values:

row - this is the default, items are laid out from left to right

row-reverse - items are laid out from right to left

column - items are laid out from top to bottom

column-reverse - items are laid out from bottom to top

40
Q

What is justify-content and its values?

A

The justify-content property controls how items are arranged on the main axis. It has these values and more:

center
flex-start
flex-end
space-between
space-around
space-evenly
41
Q

What is align-items and its values?

A

The align-items property is used to adjust how items are laid out on the cross axis. It has these values:

flex-start
flex-end
center

42
Q

What is the align-self property and its values?

A

The align-self property is applied to the individual item inside the container rather than the container itself. It takes similar values to the align-items property:

flex-start
flex-end
center