English

What are three ways of creating style rules? Give examples of each.

Advertisements
Advertisements

Question

What are three ways of creating style rules? Give examples of each.

Code Writing
Very Long Answer
Advertisements

Solution

The three ways of creating style rules are as follows:

  1. Inline: Styles are integrated directly into the HTML code they modify.
    For example,
    <h3 style = "font.family = Arial ; color = red ">
  2. Internal: Styles are applied to the website’s header data, which then influences all of the relevant tags on the page.
    For example,
    <head>
    <style type = "text/css">
    h3 { font.family : Arial ; color : red ; }
    </style>
    </head>
  3. External: Styles are referenced from within the header of the real web page after being coded in a different document. Let’s take the example of a CSS file called sample.css:
    h3 { font.family : Arial ; color : red ; }
    
    p { font.family : Times New Roman ; color : blue ; }
    
    ...and so on...

The <link tag is used as follows to connect the sample.css file to an HTML document:

<head>
<link rel = "Style sheet" type = "text/css" href = "sample.css">
</head>
shaalaa.com
  Is there an error in this question or solution?
Chapter 6: Cascading Style Sheets (CSS) - Assignment [Page 275]

APPEARS IN

Sumita Arora Computer Applications [English] Class 10
Chapter 6 Cascading Style Sheets (CSS)
Assignment | Q 15. | Page 275
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×