Results 1 to 5 of 5

Thread: Where do I enter the CSS

  1. #1
    Join Date
    Jul 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Where do I enter the CSS

    I am completely new to this and would like to know what part of the page I enter the CSS and where I enter the HTML

  2. #2
    Join Date
    Jul 2007
    Location
    Azerbaijan, Baku
    Posts
    144
    Thanks
    11
    Thanked 27 Times in 25 Posts

    Default

    Welcome to css bigzan.

    I don't know good css tutorials, but try this: http://www.w3schools.com/css/

    For your question. This is our page:
    Code:
    <html>
    <head>
    <title>My Page</title>
    </head>
    <body>
    </body>
    </html>
    You can enter css: between <head></head> tags and <body></body>

    Also you can import a css file. To import it you need to write it between <head></head> tags:

    Code:
    <link rel="stylesheet" href="yourfile.css" />
    Change yourfile.css to your css file.

    If you have any other quesions post here. I'm glad to answer them

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Technically speaking style belongs in a style section in the head, or in an external stylesheet linked to the head, or in an inline style attribute of an HTML tag. Browsers will usually error correct if stylesheets appear in or linked into the body. But as I say it is technically not allowed, so some browsers may ignore them there.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    I would recommend that you DO NOT place any CSS in your (X)HTML files. Instead "link" a separate css file to your (X)HTML files.

    Look at the following XHTML code:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    
    <title></title>
    
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta http-equiv="content-language" content="en" />
    <link rel="shortcut icon" href="/images/favicon.ico" type="image/ico" />
    
    	
    <link rel="stylesheet" type="text/css" media="screen" href="screen.css" />
    
    	
    </head>
    
    <body>
    
    .......
    This line: <link rel="stylesheet" type="text/css" media="screen" href="screen.css" /> is saying that all of the CSS for this page resides in a file called "screen.css". In this case the "screen.css" file would be placed in the same directory on your web server as the file that holds the above code.

    in your .css file you do not need any html tags, DOCTYPE info, or anything else, other than the CSS. CSS comments look like: /* COMMENT */

    The following CSS might be inside of the "screen.css" file:

    Code:
    /*
    LINKS
    -------------------------------------------------*/
    
    a:link, a:active, a:visited {
    	color: #0000ff;
    	}
    
    a:hover, a:focus {
    	color: #000;
    	text-decoration: underline;
    	}
    
    .external {
    	background: url(/images/ex_link.gif) no-repeat right top;
    	padding-right: 10px;
    	}
    	
    .clearfix:after {
    	display: block;
    	visibility: hidden;
    	clear: both;
    	height: 0;
    	content: ".";
    	}
    	
    .clearfix {display: inline-block}
    .clearfix {display: block}
    
    .strong {
    	font-weight: bold;
    	}
    	
    /*
    STANDARD FONT FAMILY
    -------------------------------------------------*/
    
    body { font-family: Verdana, Arial, sans-serif;}
    
    /*
    BODY
    -------------------------------------------------*/
    
    body {
    	background: #fff url(/images/bg.gif) top center repeat-y;
    	color: #151515;
    	font-size: small;
    	min-width: 965px;
    	}
    
    /*
    WRAPPER
    -------------------------------------------------*/
    
    #wrapper {
    	background: #fff;
    	color: #151515;
    	width: 965px;
    	margin: 0 auto;
    	}
    And that's it!

    Good luck!
    Last edited by JasonDFR; 07-06-2008 at 04:52 PM. Reason: typo

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I realize that due to the current vogue in XHTML, it's sometimes unavoidable. However, it is almost always a bad choice, and if it can possibly be avoided, it should be. The most stable current standard is HTML 4.01 strict.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •