HTML & CSS Flashcards

1
Q

what is a “void element”?

A

an html element that doesn’t have a closing tag.
img elements have an opening tag without a closing tag. An element without a closing tag is known as a void element.
input elements are also void elements and do not need closing tags.

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

what attributes does an <img></img> tag have?

A

src - contains the url/path where the pic can be found
alt - text used for screen readers to improve accessibility and used incase the image fails to load

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

what is this element called?
<a></a>

A

and anchor element. sometimes called hrefs because it contains the href attribute.
Example: <a></a>

if you want the link to open in a new tab you can use the target=”_blank” attribute after the href attribute.

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

how do you turn a photo or image into a link?

A

you wrap the image in an anchor tag!
Example:
<a>
<img></img>
</a>

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

forms!!! how do you make a form?
what does the action attribute do?

A

<form></form>

– nest all your form stuff in between these two tags.

the action attribute, tells the program where to send the info that is collected by the form.
Example:

<form></form>

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

In order for a form’s data to be accessed by the location specified in the action attribute, you must give the text field a name attribute and assign it a value to represent the data being submitted.

Here is an example of an input element with a name attribute:

Example:

<form>
<input></input>
</form>

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

talk to me about the “required” attribute on input fields.

A

To prevent a user from submitting a form when required information is still missing, you need to add the “required” attribute to an input element.
The required attribute is just the word required – you don’t need a value or quotes. Just add the word required to the input element, making sure there is space between it and other attributes.
example:
<input required type=”text” name=”catphotourl” . . .

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

what are inline elements

A

inline elements don’t automatically start on a new line.
They will go to the side (inline) next to the item above them in the hTML

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

how do you differentiate “input” elements?

A

There are all sorts of input elements
They are differentiated by the “type” attribute
Example
<input></input> – this creates a radio button
<input></input> – this creates a a text box/text field

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

what does the <label></label> element do?

A

The label element will make everything inside of it clickable.
Example:
<label><input></input> Indoor</label>
now, you can click on the radio button circle OR clicking on the word “Indoor” will also select the radio button. Or in other words, the <label> elements helps associate the text for an input element with the input element itself</label>

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

how do you make it so that only one radio button can be selected at the same time?

A

To make it so selecting one radio button automatically deselects the other, both buttons must have a name attribute with the same value.
<input “ type=”radio” name=”in-out”> Indoor
<input></input> Outdoor

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