Using HTML Tags 2 Flashcards

1
Q

Describe the broad attributes of HTML forms

A

A form is set with &ltform> &lt/form>
Inputs with ex. &ltinput type=”button”>

Send the info of the form to a file with &ltform action=”filename.js”>

The form-data can be sent as URL variables (with method=”get”) or as HTTP post transaction (with method=”post”).

Input tags have names &ltinpute type=”button” name=”input-name”>
The name defines the entry name wherever the form is sent.

We give input tags ids and assign labels to them with label tags
&ltlabel for=”lname”>Last name:&lt/label>

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

Send information to the server
Send user to a “thank you for submitting” page.
(This will need updating once backend is learned)

A

The “form” tag
The “action” attribute brings them to the URL
&ltform action=”/url”>

&ltinput>

&lt/form>

Sends client to “/url” after submitting form.

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

Get input that is:

text

A

&ltinput type=”text”>

Default input is text.
Any type=”x” for x that is not a defined input type will also default to text.

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

Tag for input that defines a “default input” (that grey text that gets automatically replaced)

A

&ltinput type=”text” placeholder=”this is placeholder text”>

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

Tag that gives default input into a text form area

A

&ltinput type=”text” value=”this is default text”>

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

Create a submit button

Create a submit button that sends information

A

&ltbutton type=”submit”>

text of the button

&lt/button>

To make it submit, make it apart of a form:
&ltform action=”https://www.freecatphotoapp.com/submit-cat-photo”>

&ltinput type="text" placeholder="cat photo URL">

&ltbutton type=”submit”> this button submits the form

/form>

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

Require a field to be filled out before submission allowed

A

&ltinput type=”text” required>

required tag can be anywhere inside

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

Create multiple choice input with a radio button (mutually exclusive options).

A

You create a “radio” button and a “label” for it
With input type “radio”.
All input type “radio” with the same “name” will be mutually exclusive connected selection options.

&ltlabel>
&ltinput type=”radio” name=”indoor-outdoor”>Indoor
&ltinput type=”radio” name=”indoor-outdoor”>Outdoor
&lt/label>

Will give:
o Indoor
o Outdoor

Input type will create a button.
Label can label those buttons.

It’s considered best practices to separate them and assign the label to the button:
&ltinput id=”indoor” type=”radio” name=”indoor-outdoor”> (creates a button with an id)
&ltlabel for=”indoor”> Indoor /label> (assigns the label for the an id)

you can do it without “id” and “for”:
&ltinput type=”radio” name=”indoor-outdoor”> (creates a button with an id)
&ltlabel> Indoor &lt/label> (assigns the label for the an id)

Can also nest the input inside the label. By wrapping an input element inside of a label element it will automatically associate the radio input with the label element surrounding it.

&ltlabel for=”indoor”>
&ltinput id=”indoor” type=”radio” name=”indoor-outdoor”>Indoor
&lt/label>

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

Create multiple choice that allows multiple options

A

&ltinput type=”checkbox”>

Each of your checkboxes can be nested within its own label element.

All related checkbox inputs should have the same name attribute.

By wrapping an input element inside of a label element it will automatically associate the checkbox input with the label element surrounding it.

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

To import something specific with radio or checkbox input types.
What happens if you omit this attribute?

A

&ltlabel for=”indoor”>
&ltinput id=”indoor” value=”INDOOR” type=”radio” name=”indoor-outdoor”>Indoor
&lt/label>
&ltlabel for=”outdoor”>
&ltinput id=”outdoor” value=”OUTDOOR” type=”radio” name=”indoor-outdoor”>Outdoor
&lt/label>
These would write to the form under name “indoor-outdoor” the value of either “INDOOR” or “OUTDOOR”.

If the attribute is omitted, it will just write to the form the default “on” for “indoor-outdoor” regardless of which option was selected.

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

Have the boxes of radio or checkbox ticked by default
What happens if multiple radio options have defaulted?
What happens if multiple checkbox options have defaulted?

A

“checked”
&ltinput type=”radio” name=”test-name” checked>

It checks the latest one (the last one processed presumably)

It checks all of them

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

&ltdiv> element does what

A

The &ltdiv> HTML element is the “generic container” for flow content.
It has no effect on the content or layout
Subsequent div containers will start on a new line. (But this is common for html elements and I don’t know the significance yet)

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

What makes head?

What makes body?

A

head-
The &lthead> contains machine-readable information (metadata) about the document, like its title, scripts, and style sheets.
It primarily holds information for machine processing, not human-readability. For human-visible information, like top-level headings and listed authors, see the &ltheader> element.
document title goes in the head.

body-
The represents the content of an HTML document. There can be only one &ltbody> element in a document.

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

What’s the difference between head and header?

A

Head tag:
The HTML &lthead> element provides general information (metadata) about the document, including the page title, script links/definitions, and style links/definitions.

Header tag:
The HTML &ltheader> element represents a group of introductory or navigational aids. It may contain some heading elements but also other elements like a logo, wrapped section’s header, a search form, and so on.

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

Create a < in an HTML doc but have it read as a string

A

& lt (with no space)

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

Create a > in an HTML doc but have it read as a string

A

& gt (with no space)

17
Q

Create a & in the an HTML doc but have it read as a string

A

& amp (with no space)

18
Q

Add a horizontal line across whole page

A

&lthr>

19
Q

Line break anywhere, not just in a paragraph

A

&lbr>

20
Q

Access a js file

A