Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

CSS - Where to put


Where to put CSS

There are three ways to insert CSS
  • Inline Style
  • Internal Style sheet
  • External Style sheet
1. Inline Style
Inline Styles come with basic features.  To use Inline Styles, you can use style attribute with the relevant HTML element tag. Style attribute containg any CSS property.
Ex: 
<p style = "align : center; color : Red"> This is a Paragraph uses CSS styles </p>
This example displays the text of "This is a Paragraph uses CSS styles" with center align and red color. All CSS properties related to the HTML element define as the value of style attribute and each property seperated by a semi colon. Value of the property define with a colon mark.

CSS Syntax

CSS Syntax

  • CSS Syntax has two parts namely a Selector and one or more Declaration. The Selector is a normal HTML element. Each Declaration consists of a property which is the attribute you want to change and property's value.
    Ex:
    body{
     color : yellow;
    }

  • For more readable, put one declaration on each line. 

  • CSS Comments
    Comments are used to describe the code & more helpful to refer code later date. For both single line & multiple lines uses same comment in CSS. It starts with /* & ends with */.
    Ex:
    /* This is a CSS Single line comment */
    body{
     color : yellow; /* This describes font color of the HTML Body */
    }

CSS Introduction

What is CSS

  • CSS Stands for Cascading Style Sheets
  • CSS defines how HTML elements are to be displayed
  • Use to control the style and layout of HTML Documents
  • CSS can define internally or externally to the HTML Document
  • External CSS Files enable you to change the appearance of the whole website by editing one single file
  • All Web Browsers support CSS