10. Identify the errors in the codes below and write the correct code:
i. import url (style_imp.css)
ii. <STYLE> P{color:808080} </STYLE>
iii. <p style="text:align: justify">
iv. P{font: arial 15px sans-serif;}
V. {p-color:red;}
Answers
Question:-
Identify the errors in the following codes and write the correct code.
Answers:-
Question 1.
Given CSS code,
import url(style_imp.css)
Here, the syntax to importing the stylesheet in html document is wrong. The right syntax is:-
@import "style_imp.css";
Don't forget to give the semicolon at the end.
Question 2.
Given code,
<STYLE>
P{color:808080}
</STYLE>
There are two errors in this code. Semicolon is not given and the # symbol is not given before the hexadecimal color code. Write this.
<STYLE>
P
{
color:#808080;
}
</STYLE>
Question 3.
Given code,
<p style="text:align: justify">
Again, the semicolon is not given. We must write semicolon at the end of every statements in CSS.
Also, the syntax for alignment is text-align:
alignment;
Write this.
<p style="text-align: justify;">
Question 4.
Given code,
P{font: arial 15px sans-serif;}
There are 3 errors.
size in pixels must be written at first and then we have to give the font color.
Also, we have to give a comma after the font style.
Write this,
P
{
font: 15px arial, sans-serif;
}
Question 5.
Given code,
{p-color:red;}
There is no statement like p-color. Write this.
p
p{
p{color: red;
p{color: red;}