What is the CSS style?

Discussion in 'CSS' started by saramobile, May 22, 2007.

  1. #1
    What is the CSS style?
    how can i use it for my pages in web pages?
     
    saramobile, May 22, 2007 IP
  2. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi Sara,

    CSS (or "Cascading Style Sheets" for short) is a presentational markup language used to present a visual style (or appearance) to a Web site. It works with HTML (a structural markup language) to give a Web site its look and feel.

    The easiest way to create a stylesheet is to create a new stylesheet file (the same way you would create an HTML file), but don't put any HTML code in there whatsoever. Instead of saving it as page.html (or whatever.html) save it with a .css extension instead. It can even be an empty file to start.

    From there, go into the HEAD section of your HTML file and add this line of code:
    
    <link rel="stylesheet" type="text/html" href="stylesheet.css" media="screen">
    
    Code (markup):
    The "link" tag is used to link the stylesheet to the Web page. The type attribute tells the browser how it's being served (as plain text, but treated like HTML), the href="" attribute is just the link to the stylesheet (in this case, stylesheet.css but it can be mystyles.css or yourstyles.css or mydoglarrysstyles.css, whatever you want to call it, as long as the .css extension is used; also it says the stylesheet is in the same folder as the Web page itself) and the media attribute says that only regular Web browsers (on your PC or Mac) should get the file (everything else - PDAs, cell phones, and the like can go without).

    SitePoint has a wonderful collection of CSS resources you can use to help you learn. The best ones are in the forums there, in the CSS board:
    http://www.sitepoint.com/forums/showthread.php?t=171943
    http://www.sitepoint.com/forums/showthread.php?t=121128

    Hope that helps. If you have any other questions, don't hesitate to ask (either here or at SitePoint).
     
    Dan Schulz, May 22, 2007 IP
  3. Leox Adir

    Leox Adir Guest

    Messages:
    237
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Look the tutorials at tizag.com/cssT
     
    Leox Adir, May 22, 2007 IP
  4. qwer123

    qwer123 Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    look at the css zen garden: http://www.csszengarden.com/
     
    qwer123, May 28, 2007 IP
  5. diarmuid

    diarmuid Peon

    Messages:
    285
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #5
    As with anything to do with the internet, I would have to reccoment W3 Schools as one of the best sites W3schools It has tonnes of information on CSS, and also on all the other programming languages.

    Diarmuid
     
    diarmuid, May 28, 2007 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    Dan, you oughta fix the typo. that should be "text/css".

    cheers,

    gary
     
    kk5st, May 28, 2007 IP
  7. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Gary,

    Thanks for catching the typo. Unfortunately I can't edit my post anymore, and I can't believe I let that slip through.

    Please consider this the "correction" post. :)
     
    Dan Schulz, May 28, 2007 IP