Search

HTML with CSS

CSS (Cascading Style Sheets) is used to apply styles to HTML documents. This is because HTML is not intended to provide styles.

There are three types of CSS which are given below:

  • Inline CSS
  • Internal or Embedded CSS
  • External CSS

Inline CSS Example :-

<!DOCTYPE html> 
<html>
   <body>
      <p>I am normal Paragraphs </p>
      <p style="color:red;">I am red Paragraphs</p>
      <p style="color:blue;">I am blue Paragraphs</p>
      <p style="font-size:50px;">I am big Paragraphs</p>
   </body>
</html>

HTML Styles Attribute

CSS The css style attribute specifies an inline style for an element html tag .Inline CSS
The HTML Inline styles Attribute  has the following Syntax :-

Inline CSS Example  :-   <tagname style="property:value;">

Internal or Embedded CSS

The HTML Internal styles Attribute  has the following Syntax :-

<!DOCTYPE html> 
<html> 
<head>
  <title>Internal css</title>
  <style>
     .selector{
     Property:value;
     }
  </style>
  </title>
</head>
<body>
    <p class="selector">I am normal Paragraphs </p>
</body>
</html>

External CSS

It uses the <link> tag on every pages and the <link> tag should be put inside the head section in html .

The HTML External styles Attribute  has the following Syntax :-

<!DOCTYPE html> 
<html>
   <head>
      <link rel="stylesheet" type="text/css" href="mystyle.css">
   </head>
   <body>
      <!-- some code here -->
   </body>
</html>


The external style sheet may be written in any text editor but must be saved with a .css extension. This file should not contain Other programming elements.

Stack Overlode is optimized Tutorials and examples for learning and training. Examples might be simplified to improve reading and learning and understand. Tutorials and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using Stack Overlode, you agree to have read and accepted our terms of use, cookie and privacy policy.