Things to remember 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

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/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
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
8
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
9
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
10
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
11
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
12
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
13
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
14
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
15
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
16
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
17
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
18
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
19
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
20
Q

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

A
<input type="text" id="someId" name="someName">
21
Q

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

A

Using the <fieldset> and <legend> tags

22
Q

Which tag is used to create labels for form elements?

A
<label>
23
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>
24
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.

25
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.

26
Q

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

A

The Constraint Validation API.

27
Q

Which DOM interfaces are available with the Constraint Validation API?

A

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

28
Q

What does the validationMessage property do?

A

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

29
Q

What is the purpose of the validity property?

A

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

30
Q

What does the patternMismatch property indicate?

A

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

31
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.

32
Q

Define the tooShort property.

A

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

33
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

34
Q

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

A

the typeMismatch property.

35
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.

36
Q

What attribute turns off automatic browser validation in forms?

A

The novalidate attribute.

37
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.

38
Q

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

A

Call setCustomValidity(“”) on the form field.

39
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>
40
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.

41
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.

42
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.

43
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.

44
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
45
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.

46
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.

47
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.

48
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.