Sunday, April 30, 2017

CSS

28.04.2017

CSS
Cascading Style Sheet


  • It's a simple Mechanism for Adding Styles to Webpages.
  • CSS Specifications are maintain by W3Consertium.

CSS has Simple Syntax

Selector{Property:Value}
  • Selector:-
    • What HTML tag(s) does the Property apply to
    • eg:- <body><h1><p>
  • Property:-
    • The Style That We are going to Add
    • eg:- background-color , text-align
  • Value:-
    • Varities of a Style
    • eg:- background-color-:red



We Can Write CSS Coding In Three Ways...
  1. INLINE
    • We can write CSS Simply into the element tags using 'style' called INLINE CSS.
      • <h1 style="text-align:center;">
  2. INTERNEL
    • In Internel CSS Coding will be written in the 'head' part of HTML using 'style tag'.
      • <html>
                      <head>
                               <style>
                                h4{
                                     background-color:blue;
                                     }
                              </style>
                        </head>
                       <body>
                                <h4>My First CSS</h4>
                       </body>
                       </html>

    3.EXTERNEL
    • An external style sheet is a separate file where you can declare all the styles that you want to use on your website.
    • There are 2 main things we have to do in External Style Sheet.
      • We have save that External sheet with an extension of .css
      • You then link to the external style sheet from all your HTML pages.
      • Here we have to link in the head part <head></head> of HTML.
        • <link rel="stylesheet" type="filename.css">
                              
Creating External Style Sheet...

  1. Open A normal Text Editor.
  2. Type CSS code into a plain text file, and save with an extension of .css
Sample CSS Document
Selectors
In CSS, selectors are used to select the element(s) you want to style.
  • id Selector
    • In CSS
      • #intro{}
    • In HTML
      • <p id="intro">
  • class Selector
    • In CSS
      • .intr0{}
    • In HTML
      • <p class="intro">

So, by linking to it from all web pages, all of our HTML documents will use the styles from the external style sheet.
If you want to change anything, you only need to update the external style sheet.

CSS + HTML...

1 comment:

My First Day with Uki DN Cohort 1

 "Hello WORLD!"