HTML/CSS Flashcards

1
Q

What is the difference between HTML, CSS, and JavaScript?

A

HTML (Hypertext Markup Language) is used for structuring and presenting the content of a web page.
CSS (Cascading Style Sheets) is used for styling and layout of the HTML elements.
JavaScript is a programming language that allows for interactivity and dynamic behavior on web pages.

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

What is the box model in CSS?

A

The box model in CSS describes the layout and sizing of elements. It consists of the content area, padding, border, and margin. The total width and height of an element are calculated as the sum of its content, padding, border, and margin.

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

What is responsive web design, and how do you achieve it?

A

Responsive web design is an approach to create websites that adapt to different screen sizes and devices. It ensures that the content and layout adjust automatically to provide the best user experience. Achieving responsiveness involves using fluid layouts, flexible images, and media queries in CSS.

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

What are media queries in CSS, and how do they work?

A

Media queries are CSS features that allow different styles to be applied based on various device characteristics such as screen width, height, and resolution. They are used to create responsive designs by defining different CSS rules for different screen sizes or devices.

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

What are the different ways to include CSS in a web page?

A

CSS can be included in a web page in several ways, including external style sheets, internal style sheets, and inline styles.

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

What is the box model in CSS?

A
  • The box model is a model used by CSS to represent the layout of a web page.
  • It consists of four parts: content, padding, border, and margin.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between margin and padding in CSS?

A
  • Margin is the space outside of an element’s border, while padding is the space inside of an element’s border.
  • Margin can be used to create space between elements, while padding can be used to create space within an element.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a CSS selector?

A
  • A CSS selector is a pattern used to select elements in a web page.
  • It can be based on the element’s tag name, class, ID, or other attributes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the difference between a class and an ID in CSS?

A
  • A class can be applied to multiple elements, while an ID can only be applied to one element.
  • IDs are typically used to target a specific element, while classes are typically used to group elements together and apply styles to them.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a pseudo-class in CSS?

A
  • A pseudo-class is a keyword added to a selector that specifies a special state of the selected element.
  • Examples of pseudo-classes in CSS include :hover, :active, and :focus.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the float property in CSS?

A
  • The float property is used to position an element to the left or right of its container.
  • It is often used to create columns in a web page layout.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the difference between em and rem units in CSS?

A
  • The em unit is based on the font size of the parent element, while the rem unit is based on the font size of the root element.
  • Rem units are often used in responsive layouts because they are not affected by changes in the font size of the parent element.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a doctype in HTML?

A

A doctype is a declaration at the beginning of an HTML document that tells the browser which version of HTML is being used.

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

What is the difference between a div and a span in HTML?

A
  • A div is a block-level element that is used to group other elements together and apply styles to them.
  • A span is an inline-level element that is used to apply styles to a specific part of a text.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a hyperlink in HTML?

A
  • A hyperlink is a link that connects one web page to another.
  • It is created using the <a> tag and the href attribute.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly