KnowledgeBoat Logo
|

Computer Applications

Identify the errors in the codes below and write the correct code:

  1. import url (style_imp.css)

  2. <STYLE> p{color:808080} </STYLE>

  3. <p style= "text:align: justify">

  4. P {font: arial 15px sans-serif;}

  5. {p-color:red;}

CSS

20 Likes

Answer

  1. import url (styleimp.css)
    The syntax of import statement is incorrect. It must be preceded by an '@' symbol and the terminator symbol ';' is also missing at the end. Thus the correct code is as follows:
    @import url(styleimp.css);

  2. <STYLE> p{color:808080} </STYLE>
    If the value of Color property is given as a Hexadecimal value, it must begin with a '#' symbol. The ' ; ' must be placed at the end of the value. Thus, the correct code is as follows:
    <STYLE> p{color:#808080;} </STYLE>

  3. <p style= "text:align: justify">
    The name of the property is "text-align" and not "text:align". The correct code is as follows:
    <p style= "text-align: justify;">

  4. P {font: arial 15px sans-serif;}
    The order of values for font property should be in the following manner:
    Syntax : Font:Font-style Font-variant Font-weight Font-size Font-family;
    Thus, the correct code is as follows:
    P {font: 15px arial sans-serif;}

  5. {p-color:red;}
    The selector should be placed outside the parentheses. The correct code is as follows:
    P {color:red;}

Answered By

8 Likes


Related Questions