My HTML Flashcards

1
Q

What does HTTP stands for?

A

Hyper Text Transfer Protocol

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

How to open links in new tabs.

A

With the target=_blank attribute.

e.g.:
<a href:”www.xyz.de” target=_blank>xyz</a>

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

How to parse all HTML before executing java scripts?

A

defer (


This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed

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

What does the async attribute do?

A

The async attribute loads and executes the script asynchronously with the rest of the webpage.

Similar to the defer attribute, the HTML parser will continue parsing the rest of the HTML as the script is downloaded in the background.

However, with the async attribute, the script will not wait until the entire page is parsed: it will execute immediately after it has been downloaded.

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

Short for writing an ul with a class of “nav” with 3 li’s with class “item” and ankers with class “links?

A

ul.nav>(li.item>a.links)*3

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

Which attribute can you use to indicate the current state of a collapsible element on the page?

A

The aria-expanded attribute:

  • When aria-expanded=”true”, it means the content is visible.
  • When aria-expanded=”false”, it means the content is hidden.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What tag is used to create a form in HTML?

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

How do you specify a text input field in an HTML form?

A
<input type="text" id="someId" name="someName">
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which attribute is used for password fields in a form?

A

type=”password”

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

What element is used to group radio buttons in a form?

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

What tag is used to label a group of related form elements within a <fieldset>?

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

How do you create a radio button in an HTML form?

A
<input type="radio" id="someId" name="someName" value="someValue">
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which HTML attribute should be used to label form controls for better accessibility?

A

for in <label> tags, linking to the id of the input element.</label>

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

How do you create a multi-line text input in an HTML form?

A
<textarea id="someId" name="someName" rows="5" cols="33"></textarea>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What type of input should you use for collecting email addresses?

A
<input type="email" id="someId" name="someName">
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the purpose of the name attribute in form elements?

A

To specify the name of the form data variable that will be sent to the server.

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

How do you add a submit button to an HTML form?

A
<input type="submit" value="Send Request">
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the correct syntax for a self-closing input tag in HTML?

A
<input type="text" id="someId" name="someName">
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How can you group and label related input elements in a form?

A

Using the <fieldset> and <legend> tags

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

Which tag is used to create labels for form elements?

A
<label>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How do you create a form field for user addresses in an HTML form?

A
<textarea id="addr" name="addr" rows="5" cols="33"></textarea>
22
Q

How does the ‘type’ attribute help in form validation?

A

It specifies the type of data that must be entered, such as a number, an email address, or another specific preset type.

23
Q

How can you use the ‘pattern’ attribute for form validation with an example?

A

Example:
~~~
<input id=”choose” name=”i-like” required pattern=”[Bb]anana|[Cc]herry”
~~~
allows only “banana”, “Banana”, “cherry”, or “Cherry” as valid inputs.

24
Q

What API in JavaScript provides methods and properties for form validation?

A

The Constraint Validation API.

25
Q

Which DOM interfaces are available with the Constraint Validation API?

A

HTMLButtonElement, HTMLFieldSetElement, HTMLInputElement, HTMLOutputElement, HTMLSelectElement, HTMLTextAreaElement.

26
Q

What does the validationMessage property do?

A

Returns a localized message describing the validation constraints that the control doesn’t satisfy.

27
Q

What is the purpose of the validity property?

A

Returns a ValidityState object containing properties describing the validity state of the element.

28
Q

What does the patternMismatch property indicate?

A

Returns true if the value does not match the specified pattern.

29
Q

What does tooLong property signify in form validation?

A

Returns true if the value is longer than the maximum length specified by the maxlength attribute.

30
Q

Define the tooShort property.

A

Returns true if the value is shorter than the minimum length specified by the minlength attribute.

31
Q

What returns true if the value is greater than the maximum specified by the max attribute and less than the minimum?

A

rangeOverflow

rangeUnderflow

32
Q

What returns true if the value is not in the required syntax (e.g., email or URL).

A

the typeMismatch property.

33
Q

In custom form validation, why is the aria-live attribute used?

A

To ensure custom error messages are presented to all users, including those using screen readers.

34
Q

What attribute turns off automatic browser validation in forms?

A

The novalidate attribute.

35
Q

What is the purpose of setCustomValidity in JavaScript?

A

Allows setting custom error messages for form validation based on custom criteria beyond standard HTML attributes.

36
Q

How do you clear a custom error message set with setCustomValidity?

A

Call setCustomValidity(“”) on the form field.

37
Q

Example syntax for setting a media query in the picture element?

A
<picture>
  <source media="(min-width: 650px)" srcset="desktop-image.jpg">
  <img src="mobile-image.jpg" alt="Responsive image">
</picture>
38
Q

What is REST?

A

REST (Representational State Transfer) is an architectural style for building standards between computer systems on the web, making communication between systems easier. RESTful systems are stateless and separate the concerns of client and server.

39
Q

What does “Separation of Client and Server” mean in REST?

A

In REST, the client and server are implemented independently, allowing changes on one side without affecting the other. This modular separation improves flexibility, scalability, and allows both components to evolve separately.

40
Q

What does “stateless” mean in REST?

A

Statelessness in REST means that the server does not store any information about the client’s state. Every request from the client contains all the necessary information for the server to understand and process it without relying on prior interactions.

41
Q

How does communication between client and server work in REST?

A

In REST, clients send requests (e.g., GET, POST, PUT, DELETE) to retrieve or modify resources, and the server sends responses back with data or status codes. Standard HTTP verbs and headers are used for this communication.

42
Q

What are the four main HTTP verbs used in RESTful systems?

A
  • GET: Retrieve a resource or collection of resources
  • POST: Create a new resource
  • PUT: Update a specific resource
  • DELETE: Remove a resource
43
Q

What are MIME types in REST headers?

A

MIME types specify the type of content in HTTP requests and responses. Common MIME types include text/html, image/jpeg, application/json, and video/mp4. The client specifies the acceptable MIME types in the request’s “Accept” field.

44
Q

What is an example of an HTTP GET request in REST?

A

A GET request to fetch a specific resource:
GET /articles/23
Accept: text/html, application/xhtml
This requests the article with id 23, and the client can accept HTML or XHTML content.

45
Q

What does the header “Content-Type” indicate in a REST response?

A

The “Content-Type” header specifies the type of data the server is sending back in the response, which should match one of the acceptable MIME types listed in the client’s request.

46
Q

How are resource paths structured in RESTful APIs?

A

Resource paths should be hierarchical and descriptive, often using plural forms of resources (e.g., /customers/223/orders/12). Paths can refer to collections or specific resources by appending an ID to the path.

47
Q

How can you add a slider to youre HTML?

A

With input of type range. With min and max you can specify the distance. Witch value you set the initial value. And with stepp you say set how the distance the slider moves each time.

<input id="slider" type="range" min="0" max="10" value="0" step="1" />
48
Q

What are global attributes in HTML?

A

Global attributes are HTML attributes that can be used with all elements. E.g.:

class - Used to specify a class name for styling.

title - Used to specify additional information about
an element.

id - Used to specify a unique ID for an element for
styling purposes or links within a single web page.

style - Used for inline styling.

49
Q

How can you use HTML to declare the language of the web page? Why is this important?

A

The lang attribute is used to declare the language of the web page. It should be included inside the <html> tag.

<html lang="en">

</html>

Declaring the language of a webpage is important because it lets search engines and browsers know the language in which a webpage appears. Yes, a user will not directly see this attribute. But because it has an impact on how a browser reads the page, you should specify a language.

50
Q

How do you create an input field that can be used in a form?

A

/form action=”restaurants”/
/label for=”name-input”/Name//label/
/input id=”name-input” type=”text” name=”name”/
/input type=”submit” value=”Submit”/
/form/