Saturday, May 25, 2019

Cascading Style Sheet (CSS)




CSS Definition

Stands for "Cascading Style Sheet." Cascading style sheets are used to format the layout of Web pages. They can be used to define text styles, table sizes, and other aspects of web pages that previously could only be defined in a page's HTML. 



CSS can be added to HTML elements in 3 way:
  1. Inline -  by using the style attribute in HTML elements.
  2. Internal - by using a <style> element in the <head> section.
  3. External - by using an external css file. 

Inline

          An inline CSS is used to apply a unique style to a single HTML element.
         An inline CSS uses the style attribute of an HTML element. 


      <html>
                <body>
                          <h1 style="color:navy;"> Inline </h1>
                </body>
        </html>

Internal
           An internal CSS is used to define a style for a single HTML page.          An internal CSS is defined in the <head> section of an HTML page, 
within a style element:

        <html>
                  <head>
                            <style>
                                       body{background-color:blue;}
                            </style>
                  </head>
                  <body>
                               Internal
                  </body>
         </html>

External

          An external style sheet is used to define the style for many HTML pages.
          With an external style sheet, you can change the look of an entire web site, 
by changing one file!
          To use an external style sheet, add a link to it in the <head> section of the HTML page:

         <html>
                   <head>
                              <link rel="stylesheet" type="text/css" href="external.css">
                   </head>
                   <body>
                               External
                   </body>
        </html>

external.css

              body {
                         background-color:powerblue;
                       }
              h1, p {
                         color:red; 
                         font-style:itlalic;
                       }

Some property
  1. Background color :- {background-color:red;}
  2. Color :- {color:blue;}
  3. Font style :- {font-style:italic;}
  4. Font weight :- {font-weight:bold;}
  5. Font family :- {font-famil:courier;}
  6. Text decoration :- {text-decoration:overline;}
  7. Text transform :- {text-transform:uppercase;}
  8. Background image :- {background-image:url(apple.jpg)}
  9. Border style :- {border-style:dotted;}
  10. Opacity :- {opacity:0.5;}
Property Values
  • Font style 
    1. Italic
    2. Oblique
    3. Initial
    4. Inherit
  • Weight
    1. Bold
  • family
    1. Arial
    2. Times new roman
    3. Helvetica
    4. Geneva
    5. Tahoma
  • Decoration
    1. Overline
    2. Line-through
    3. Underline
  • Transform
    1. Uppercase
    2. Lowercase
  • Border style
    1. Solid
    2. Dotted
    3. Dashed
    4. Double
    5. Groove
    6. Ridge
    7. Inset
    8. Outset
  • opacity
    1. 0.1 - 1.0






No comments:

Post a Comment

Express

What is Express? Express is a minimal and flexible Node.js web application framework that provides a robust set of features to develo...