11/12/15

Today's question on CSS

Will the "My title" header be printed in italics?
Suppose you have the following HTML web page implemented:
<!DOCTYPE html>
<html>
   <head>
      <style>
         h1.makemered {
            color:rgb(255,0,0);
            font-style: italic;
         }
      </style>
      <link rel="stylesheet" type="text/css" href="style.css">
   </head>
   <body>
      <h1 class="makemered" style="color:rgb(0,0,255)">My title</h1>
   </body>
</html>
   
And you have the following external CSS stylesheet (style.css) implemented:
h1.makemered {
   color:rgb(0,255,0);
}
   
Will the "My title" header be printed in italics?
Please select exactly one correct alternative.

Answer

The priority order is, generally speaking, from low to high:
  1. External style sheet
  2. Internal style sheet (in the head section)
  3. Inline style (inside an HTML element)
Only the color will be overridden by the external style sheet, so the italics style will still be used. The header will be printed green and in italics.


More questions on CSS?

http://hansrontheweb.blogspot.nl/p/css-selftest.html

No comments:

Post a Comment