[lesson 3] How to link my HTML and my CSS code ?

Discussion in 'CSS' started by algerian, Apr 30, 2009.

  1. #1
    introduction
    Your CSS code can be placed at 3 locations in the different site on the page.
    • Internal: In the HTML page
    • External: In a separate file
    • In the HTML element itself

    In the HTML of the page
    First choice: save the CSS code in the HTML page, between two tags <header> and </header>.
    <head> 
    <title> my page title </title> 
    <style type="text/css"> 
    => Here the CSS code 
    </style> 
    </head>
    Code (markup):
    In a separate file
    Second choice: in a separate file called style.css in general

    The CSS file must also be included between the two HTML tags: <header> (see example) </ header>.
    <head> 
    <title> my page title </title> 
    <link rel = "stylesheet" type = "text / css" href = "style.css" /> 
    </head>
    Code (markup):
    In the HTML tag
    Finally, it is possible to put style directly into an HTML tag
    CSS syntax and inheritance>>>
    <body bgcolor="#cccccc">
    Code (markup):
    [lesson 1] Introduction to CSS (thread:1327494)
    [lesson 2] The syntax of CSS and inheritance (thread:1327522)

    to be continued ...
     
    algerian, Apr 30, 2009 IP
  2. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #2
    <body bgcolor="#cccccc">
    Code (markup):
    That is not css; it is an html attribute, one that has not been a part of html since 1999. To inline styles, use the style attribute and css syntax for the value.
    <body style="background-color: #$ccc;">
    Code (markup):
    Is there a purpose to this series of overly elementary "tutorials"?

    gary
     
    kk5st, May 1, 2009 IP