Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Regular Coder bacterozoid's Avatar
    Join Date
    Jun 2002
    Location
    USA
    Posts
    490
    Thanks
    24
    Thanked 35 Times in 35 Posts

    Question Style Sheets - When do I use them?

    Now, first of all: I know what CSS is, and I am familiar with some of its uses and how to use it. What I am curious about is how the world is using them now. In general, I use HTML to lay out my documents, stick tables, text, etc. inside my document. I have really only used CSS for scrollbar color and dynamic links. Few questions:

    Should I be putting these properties into an external stylesheet which loads into my document?

    How compatible is CSS between different browsers? (IE handles it fine, but Netscape, Mozilla, Opera are questionable to me.)

    Should I use more CSS in my documents for everything but simple HTML layout tags?

    Basically it, might have some more later, but I don't use a whole lot of CSS and haven't bothered learning it, but I might just take it up. Thanks for any help!

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,646
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Well, you can use them anyway you wish. What's nice is calling on an external sheet for style and changing your sites appearance every-so-often by editing just the sheet.

    Best to read up on them.
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">

  • #3
    Regular Coder bacterozoid's Avatar
    Join Date
    Jun 2002
    Location
    USA
    Posts
    490
    Thanks
    24
    Thanked 35 Times in 35 Posts
    Sure, but I gotta stay 'hip' heh. That I do realize. I have made good use of external .js files. Love em. Got one question answered! Or at least one answer to one question..thanks!

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Netscape (6+), Mozilla and Opera all support CSS better than IE. I'd really recommend trying out one or more of those browsers just so you can see some of the more advanced features in CSS.

    The current direction is to move presentational markup out of HTML and rely on CSS instead. HTML/XHTML should be used for structuring your content. Style sheets can then be used to define how it looks.

  • #5
    Regular Coder bacterozoid's Avatar
    Join Date
    Jun 2002
    Location
    USA
    Posts
    490
    Thanks
    24
    Thanked 35 Times in 35 Posts
    Netscape (6+), Mozilla and Opera all support CSS better than IE.
    Really? I had no clue. I shall have to try that out. I see more now than ever the relevence of CSS. I tried out a few things with stylesheets, and it could really clean up some of my documents.

  • #6
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Originally posted by BrainJar
    Netscape (6+), Mozilla and Opera all support CSS better than IE.
    Well, IE/Windows.

    Internet Explorer 5 for Mac has surprisingly excellent support for CSS, considering its Windows counterpart.

  • #7
    Regular Coder
    Join Date
    Oct 2002
    Posts
    380
    Thanks
    0
    Thanked 0 Times in 0 Posts
    A bunch of points.

    Mozilla based browsers are far better in their support of CSS than IE (as has already been noted).

    Secondly, a lot of the HTML formating tags have been depreciated, meaning they may not be included in future browsers. This includes <center>, <font>, <b> and <i>. These tags should all be replaced with CSS (either in-line or using classes).

    External style-sheets are cached, meaning that a style-sheet will only be downloaded once, no matter how many times it is used. On a large site, this can add to the speed of the page loads after the first. I usually put site-wide styles into an external style-sheet, then add any page specific styles to a style declaration on a given page. I tend not to use in-line styles very much -- I find them too messy.

    Style-sheet make it much easier to make site-wide changes. I write my sites using the various <hn> tags and a bunch of classed paragraphs, tables and divs. If I want to change the layout of my site (include the size of the core tables that lay-out the site), I can make these changes in one file.

    You can change style properties with javascript -- so simple roll-overs can be done without any graphics. This is a far more powerful way of controlling the appearance of your site (incidentally, the core .js should also be external, which also allows it to be cached).

  • #8
    Regular Coder
    Join Date
    Sep 2002
    Location
    Burlington, VT
    Posts
    125
    Thanks
    0
    Thanked 0 Times in 0 Posts
    definately... changing to XHTML (strict HTML,very easy to learn) and CSS totally cleans up your code like you wouldn't believe. If you like external .js files, you would love php! you write a page with an external style sheet, and then split it in half, one everything about where your content goes and one everything below, then save one as top.html and the other one as bottom.html and then write your normal page like
    Code:
    <?php
    include('top.php');
    ?>
    this is all the text that would go into the middle of your page, or inside your content table, or whatever.
    <?php
    include('bottom.php');
    ?>
    
    and name the page something.php and then you're done! you change the content by changing what's right in there and you change the style of anything by changing the external .css file.

    ok this isn't really usefull or on topic but I think you'll enjoy playing w/ it, and it does go to show how removing extranious material from what you're actually working on can make life easier. That's what css is for; seperation of structure and presentation.

    -Doug
    "The focused mind can pierce through stone."
    - Japanese Maxim

  • #9
    Regular Coder
    Join Date
    Oct 2002
    Posts
    380
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I do like php, although it's often very poorly used. There's too often a confusion of logic, data and presentation. Given how powerful it is, it's too often used very badly.

    Still, I often complain about poor programme structure/architecture.

  • #10
    Regular Coder bacterozoid's Avatar
    Join Date
    Jun 2002
    Location
    USA
    Posts
    490
    Thanks
    24
    Thanked 35 Times in 35 Posts
    Well I'm glad I posted this. PHP sounds really interesting. This stuff could start to get real fun. I shall have to set aside some time to learning CSS, and then PHP...and probably finishing up JavaScript As for newer browsers removing those tags...ick. I can see why they do it though. I have read something on making CSS the default language of the web...and by the looks of things, things are heading in that direction. HTML used to be so cool. Glad I learned about this stuff 4 years ago. I'm much better off. Thanks for all the comments, made me seriously consider a few things.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,646
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Originally posted by BrainJar
    Netscape (6+), Mozilla and Opera all support CSS better than IE.
    You may want to mention that only 1% use NS6 while 92% use IE5+.
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">

  • #12
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Originally posted by zoobie


    You may want to mention that only 1% use NS6 while 92% use IE5+.
    How does that affect the fact that IE/Windows has the worst CSS support of any significant web browser?

  • #13
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How does that affect the fact that IE/Windows has the worst CSS support of any significant web browser?
    It doesnt but if 90% are using IE5+ then that is what you should be coding for. If you are coding for anything else you are wasting yours and your clients time and making things more difficult than they should be.

    Should I use more CSS in my documents for everything but simple HTML layout tags?
    Along with what has already been said I say just be consistent. It can get annoying if you are working on someone elses code and they put half of their styles inline, half in their external .css, and half in their style declaration. I guess it is more of a preference and how many styles you are putting in your page. If you are using a large amount of css on a page than you will want to make an external css to reduce file size.

  • #14
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by bacterozoid
    ... CSS, and then PHP...and probably finishing up JavaScript
    i found it easier to learn JavaScript first... it leads on well to the basics of PHP, so does C+ etc i'm told....
    redhead

  • #15
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Originally posted by allida77
    If you are coding for anything else you are wasting yours and your clients time and making things more difficult than they should be.
    If you code to standards, you can be assured of it working several years down the line in whatever the popular browser(s) may be.

    In actuality, you are saving you and your client's time and money.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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