CSS - Inline Style Sheet


CSS - Stylesheet

  • When a browser reads a style sheet, it will change the HTML document in accordance with information in the style sheet.
  • CSS Style sheet describes the presentation of an HTML document in the browser window.

Inline Style Sheet :

  • In CSS, we can use style attributes for any HTML element to define styles. 
  • These rules will be applied to that single element only (<p>, <h1>, <h2>).

Sample Code :

<html>
    <head>
    </head>
        <body>
            <h1>Welcome to Wikitechy</h1>
            <p style="color: red; font-size: 46px;">
                Best E-Learning Website In The World
            </p>
        </body>
</html>

Code Explanation :


    For a paragraph element we specified red color for text using color property.

    And font-size property is used to set the size of the font. Here, we have given 48 pixels for the font.

Output :


    Here “Welcome To Wikitechy “specifies the heading element being displayed in the output browser window with no such style sheet properties.

    The Text “Best E-Learning Website in the World” appear in red color with its font size of 48 pixels as shown in the browser window.