HTML & CSS- part 13 Flashcards

1
Q

Sample code for a media query.

A

This specifies block—that is, one on each line—for the “gallery” class of images when displayed on a phone

We define a phone as having a minimum width of 320 pixels and a maximum width of 480 pixels.

@media only screen and
(min-device-width: 320px) and
(max-device-width: 480px) {

img.gallery { /Notice how the css code for specific elements goes under the @media intro/
display: block;
}
}

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

If you want a div to be 20% of the screen width, what do you have to consider?

A

On a cell phone, that would make your div too small to be practical.

To prevent this, use:

min-width:

max-width:

min-height:

max-height:

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

What do you have to be aware of if you’re using max-height or max-width?

A

Your div might be too small to hold the content.

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

What are your options if your div is too small to hold the content?

A

You will have overflow. And you need to decide what to do with it.

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

What are your options with content overflow?

A

overflow: hidden;

overflow: scroll;

p {
min-height: 150px;
max-height: 600px;
overflow: hidden;

}

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

What’s the very first part of any HTML document?

A

<!DOCTYPE HTML>

This tells the browser the document is written in HTML5. This is what you’ll always write when you’re creating a new document, whether the document has any HTML5 features in it or not.

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

What does this mean?

<html lang=”en”>

A

This page is in English. Every HTML doc has the <html></html> pair

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

What is the basic skeleton for an HTML page?

A

<!DOCTYPE html>

<html>

<head>
<title>
</title>
</head>

<body>
</body>

</html>

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

What does this mean?

<meta></meta>

A

This tag tells the browser to use a particular flavor of text encoding that permits the greatest variety of characters, thus accommodating the greatest number of languages. The tag isn’t closed.

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

Where does <title> show up?</title>

A

<title>
in the browser toolbar,
in a bookmark list
in search engine results
</title>

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

Where do you add a meta description?

A

In the <head> of the document.

<meta></meta>

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

What does a meta description do?

A

Displays a message in the search engine results

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

What are some general rules for meta descriptions?

A

Make your description as appealing as possible, but don’t promise more than you can deliver.

Search engines cut off a description after about 160 characters. That’s a few more characters than a Twitter Tweet. Limit your description to that length.

Don’t repeat your title as a description.

Give each page on your site a unique meta description.

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

Can one element have two classes at the same time?

A

Yes.

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

How do you code two classes for one element at the same time?

A

Put them side-by-side in the class value.
Separate with a space but without a comma.
<p class=”firstClass secondClass”>

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

How what’s the default height of an empty div?

A

Zero.

17
Q

What’s the difference between these two selector phrases?

div.main h2 {
div,main, h2 {

A

The first one applies only to an h2 in the div with a class of main because there is no comma between the selectors.

Because the second one has a comma, it applies to both div.main and any h2 anywhere, regardless of if it’s in div.main.

18
Q

When creating a list for a navbar, how do you remove the browser default settings.

A

margin: 0; and padding: 0;
This will remove browser default settings

19
Q

On a vertical nav bar, how do you get the links to look like separate blocks as opposed to one big block with all the links?

A

set background-color at the LI level instead of the DIV or even UL level

On the horizontal nav bar, it happened when I added float: left;

20
Q

What’s the difference between these:
display: inline;
display: inline-block;

A

Both put them side-by-side (i.e. inline)

display: inline; Any height and width properties will have no effect

display: inline-block; The element itself is formatted as an inline element, but you can apply height and width values