Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 89 - 2626_South Point_C-7
P. 89

    Let us create a CSS file and add the code given below. Save the file with the name MYSTYLE.css.

                      body
                      {
                          background-color: lightblue;
                      }

                      h1
                      {
                          color: Red;
                      }
                      h2
                      {
                          color: Green;
                      }

                     Now, create a HTML document with the reference of the CSS file.

                      <!DOCTYPE html>
                      <HTML>
                      <HEAD>
                             <LINK REL="STYLESHEET" TYPE="TEXT/CSS" HREF="MYSTYLE.css">
                             <TITLE>External Style Sheet</TITLE>
                      </HEAD>
                      <BODY>
                             <H1>Cascading Style Sheet</H1>
                             <H2>Linking External Style Sheet</H2>

                      </BODY>
                      </HTML>

                                                            Using external Style Sheet
                          Internal Style Sheet

                     Internal style sheet is directly placed within the HTML document, typically inside the <STYLE> tag within
                     the <HEAD> section. The styles are only applied to the HTML document in which they are defined. This
                     method is suitable for small projects or when a specific page needs unique styles.

                     Let us create a web page using the internal style sheet.

                                                                                                 Using CSS in HTML5    87

| 84 85 86 87 88 89 90 91 92 93 94 |