How to define Styles with CSS


CSS Styles are declared between the opening and closing <style> tags like this usually before the closing </head> tag ,other ways of declaring CSS styles are discussed below.

     <style>
        h1{ color:#fff; padding:0px 0px 5px 5px;}
        p{ color:#fc0; margin-left :auto;}
    </style>                   

Defining styles in CSS
·         Inline Styles
Inline style is applied to an HTML element via its style attribute,
like this: <p style=”font-family: Calibri; color:#f6f6f6; padding:5px; ”>Sample Paragraph</p>
·         Embedded Styles
As we seen in our first example, you can declare
any number of CSS styles by placing them between the opening and closing <style>
tags, as follows:
<style>
*
CSS Styles will be declared here
*
</style>
·         External Stylesheets
 external stylesheet is a file (usually given a .css file extension) that contains CSS styles.
 Like this: <link rel=”stylesheet” type=”text/css” href=”yourstyleshhet.css” />

Comments

Check out

CSS Sprites | What are They?

Login form | Using CSS3

HTML5 Semantic Tags | What do they mean

Remove Scrollbars from syntaxhighlighter

Adding a button in HTML | styling a button

How CSS3 Works

HTML5 | LocalStorage

Advanced Jquery easing | Demo and Download

How to add Jquery easing effects | Jquery tutorial