Test Answers Za Javascript
Test Answers Za Javascript
Answers:
1. <header></header>
2. <tr></tr>
3. <input type="email">
4. <template></template>
5. <code></code>
6. <sub></sub>
7. <footer></footer>
8. <option></option>
9. <map></map>
10. <a target="_blank"></a>
11. <ol></ol>
12. <cite></cite>
13. <input type="url">
14. <head></head>
15. <hr>
16. <mark></mark>
17. <audio></audio>
18. <blockquote></blockquote>
19. <video></video>
20. <textarea></textarea>
1. Write the CSS code to set the font family of a paragraph to "Arial".
2. What is the CSS property used to set the font size?
3. Write the CSS code to set the font weight of a heading to bold.
4. What is the CSS property used to set the font color?
5. Write the CSS code to set the background color of a div to #f1f1f1.
6. What is the CSS property used to set the width of an element?
7. Write the CSS code to set the height of an image to 200 pixels.
8. What is the CSS property used to set the padding of an element?
9. Write the CSS code to set the margin of a div to 20 pixels.
10. What is the CSS property used to set the border of an element?
11. Write the CSS code to set the text alignment of a paragraph to center.
12. What is the CSS property used to set the line-height of an element?
13. Write the CSS code to set the text decoration of a link to none.
14. What is the CSS property used to set the opacity of an element?
15. Write the CSS code to set the background image of a div to "image.png".
16. What is the CSS property used to set the display property of an element?
17. Write the CSS code to set the font style of a text to italic.
18. What is the CSS property used to set the z-index of an element?
19. Write the CSS code to set the box-shadow of a div to 2px 2px 5px #888888.
20. What is the CSS property used to set the text-transform of an element?
Answers:
1. p { font-family: Arial; }
2. font-size
3. h1 { font-weight: bold; }
4. color
5. div { background-color: #f1f1f1; }
6. width
7. img { height: 200px; }
8. padding
9. div { margin: 20px; }
10. border
11. p { text-align: center; }
12. line-height
13. a { text-decoration: none; }
14. opacity
15. div { background-image: url("image.png"); }
16. display
17. text { font-style: italic; }
18. z-index
19. div { box-shadow: 2px 2px 5px #888888; }
20. text-transform
1. Write the HTML code for a form with a text input field and a submit button.
2. Write the CSS code to set the font size of all table cells to 16px.
3. Write the HTML code for a table with two columns and two rows, where the first row
contains column headers and the second row contains data.
4. Write the CSS code to center align the text of all list items.
5. Write the HTML code for an ordered list with three list items.
6. Write the CSS code to set the background color of all even table rows to light gray.
7. Write the HTML code for a select element with three options: red, green, and blue.
8. Write the CSS code to set the font weight of all headings to bold.
9. Write the HTML code for a textarea element with 5 rows and 10 columns.
10. Write the CSS code to set the color of all links to blue.
Answers
1.
<form>
<button type="submit">Submit</button>
</form>
2.
td {
font-size: 16px;
}
3.
<table>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
4.
li {
text-align: center;
5.
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
6.
tr:nth-child(even) {
background-color: lightgray;
7.
<select>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
</select>
8.
font-weight: bold;
9.
10.
a{
color: blue;
}
1. Write the CSS code to create a box with a width of 200px, a height of 100px, a border
thickness of 2px, a solid black border color, and a solid blue background color.
2. Write the CSS code to center align a box horizontally within its parent container.
3. Write the CSS code to create a box with a width of 200px, a height of 100px, a
padding of 20px on all sides, and a border thickness of 2px.
4. Write the CSS code to create a box with a width of 200px, a height of 100px, a margin
of 50px on all sides, and a border thickness of 2px.
5. Write the CSS code to create a box with a width of 200px, a height of 100px, a margin
of 50px on the top and bottom and 100px on the left and right, a padding of 10px on
all sides, and a border thickness of 2px.
Answers
1.
.box {
width: 200px;
height: 100px;
background-color: blue;
2.
.box {
width: 200px;
height: 100px;
margin: 0 auto;
}
3.
.box {
width: 200px;
height: 100px;
padding: 20px;
4.
.box {
width: 200px;
height: 100px;
margin: 50px;
5.
.box {
width: 200px;
height: 100px;
padding: 10px;
}
1. Write the CSS code to create a flex container with a direction of row and wrap set to
wrap.
2. Write the CSS code to align items in the center of a flex container.
3. Write the CSS code to distribute items evenly along the main axis of a flex container.
4. Write the CSS code to give an item in a flex container a fixed width of 100px and a
flex-grow value of 1.
5. Write the CSS code to give an item in a flex container a fixed width of 100px and
prevent it from shrinking or growing with flex-shrink and flex-grow properties set to
0.
Answers
1.
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
2.
.container {
display: flex;
align-items: center;
3.
.container {
display: flex;
justify-content: space-between;
}
4.
.item {
flex-basis: 100px;
flex-grow: 1;
5.
.item {
flex-basis: 100px;
flex-shrink: 0;
flex-grow: 0;
1. Write the CSS code to create a red heading with a font size of 36px and a line height
of 1.5.
2. Write the CSS code to center a paragraph of text horizontally within its parent
container.
3. Write the CSS code to add a 2px solid border to an image and position it 10px from
the top and right edges of its container.
4. Write the CSS code to create a link that changes color to blue when hovered over.
5. Write the HTML and CSS code to create a paragraph of text with a background color
of yellow, white text color, and a line height of 1.5.
1.
h1 {
color: red;
font-size: 36px;
line-height: 1.5;
}
2.
p{
text-align: center;
3.
img {
position: absolute;
top: 10px;
right: 10px;
4.
a:hover {
color: blue;
5.
HTML:
CSS:
p{
background-color: yellow;
color: white;
line-height: 1.5;