WDD - Implementation (CSS and HTML) Flashcards

(34 cards)

1
Q

Explain the purpose of the CSS float property.

A

The float property places an element on the left or right side of its container.

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

Write a CSS rule to put any images in the class cartoonImage to the right of the page

A

.cartonImage{float:right;}

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

Explain the purpose of the CSS height and width properties.

A

The CSS height and width properties are used to set the height and width of an element.

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

Complete the CSS rule below to make a section of the webpage about Newcastle appear on the left hand side of the page with the following dimensions -300px × 200px
#newcastle{
}

A

newcastle{

width: 300px;
height: 200px;
float:left;
}

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

Describe the effect of the CSS display:none property.

A

The element is not displayed.

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

Describe the effect of the CSS display:inline property.

A

The element is dislayed on the same line as the preceding element.

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

Describe the effect of the CSS display:block property.

A

The element is displayed as a block, generating line breaks before and after.

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

Write a CSS rule to hide the section of a website shown below?

<div>
<p> Burger </p>
<p> £7.99 </p>
</div>

A

burgerInfo{display:none;}

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

The a website contains the following HTML

<section>
<p>Fruits</p>
<p>Vegetables</p>
<p>Animals</p>
</section>

Write a CSS rule (without using float) which will make the content display on website as shown below.
Fruits Vegetables Animals

A

.categories p{display: inline-block;}

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

What is the difference between display block and display inline?

A

Block elements start on a new line and fill the whole width. Inline elements stay in the same line and only take up as much space as needed.

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

Describe the difference between CSS margins and padding.

A

The margin property is used to create space around an element outside its border.
The padding property is used to create space around an element inside its border.

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

What does clear: both; do?

A

Clear both removes the effect of any floats elements on both sides.

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

The layout around and image of the the jungle should have 10 pixel gaps above and to the left of the image, there should also be a gap of 20 pixels to the right of the image .
Create a CSS rule for this image.
.jungleImage {}

A

.jungleImage { margin-top:
10px; margin-left: 10px ;
margin-right: 20px ;}
OR
.jungleImage { padding-top:
10px; padding -left: 10px ;
padding -right: 20px ;}

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

What does clear: left; do?

A

Clear left removes the effect of any floats elements on the left side.

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

What does clear: right; do?

A

Clear right removes the effect of any floats elements on the right side.

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

Explain what this code will do
nav ul {
list-style-type: none;
}

A

Remove Bullet Points from the nav bar

12
Q

Write a CSS rule to remove the bullet points from the nav bar

A

nav ul {
list-style-type: none;
}

13
Q

Explain what this code will do
a:hover {
background-color: green;
}

A

It will change the background colour to green when the mouse hovers over an anchor (link)

14
Q

Write a CSS rule which the appearance of the link in the nav bar to have a blue background and red text when the mouse hover overs it

A

nav ul li a:hover {
background-color: blue;
color: red;
}

15
Q

The following code has been used to remove the bullet points from the nav bar:
nav ul {
list-style-type: none;
}
Explain why the unordered list in the nav bar will display differently to any other unorder list in the website?

A

The code uses a descendant selector this code only selects and modifies unordered lists in the nav element therefore other unordered list are not affected.

16
Q

Write a CSS rule to create a horizontal navigation bar so that:
no bullet points are shown,
each item is placed horizontally with 100 px width for each element and the text in the center, 10 pixels padding in added around each link, when the cursor goes over the the link the background is blue and the text is yellow.

A

nav ul {
list-style-type: none;
}

nav ul li {
float: left;
width: 100px;
text-align: center;
}

nav ul li a {
display: block;
padding: 10px;
}

nav ul li a:hover {
background-color: blue;
color: yellow;
}

17
Q

Write a CSS rule to to make all content in the following classes have a red background. Top and Middle

A

.top, .middle { background-color: red;}

17
Q

A section of the CSS code for styling a website is shown below:

main {background-color: red;}
#king {background-color: red; padding: 10px;}
p {padding: 10px;}
h1 {color: white; font-size: 22px; padding: 10px;}
main h2 {padding: 10px;}

Use grouping selectors to re-write the code to make it more efficient

A
  • main, #king
    {background-color: red}
  • # king, p, h1, main h2{padding: 5px}
  • h1 {color: white; fontsize: 22px}
18
Q

Write a CSS rule to to make all margins for images, h2 and h3 headings 20 pixels,

A

h2,h3,img {margin:20px;}

19
Describe a grouping selector.
CSS selectors can be grouped together, allowing the same style to be applied to multiple elements. e.g h1, h2, p { color:green; }
20
What type of CSS rule has been used below? h1, h2, p { color:green; }
A grouping selector
21
Create a CSS rule to make any text in the paragraph elements in the main section of the website purple
main p{ color: purple; }
22
State the type of selector shown below and state its effect footer p {font-size: 10px; }
** Desendant Selector** The CSS rule would only be applied to paragraphs in the footer element.
23
What HTML Layout elements are used to define the major areas of a web page.
24
write a CSS rule to make this HTML element yellow

Make me yellow.

#yellow { background-color: yellow; }
25
write a CSS rule to make this HTML element yellow

Make me yellow.

.yellow { background-color: yellow; }
26
Write the html tags which would be used to create a form element on your web page
27
Write the HTML which would allow a users to enter there first name in a form
First Name:
28
Surname: