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.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Nov 2008
    Posts
    21
    Thanks
    3
    Thanked 0 Times in 0 Posts

    CSS contained within the XHTML file?

    Hi.

    I was wondering if it is better practice to have your CSS as a seperate stylesheet or is it ok to have it included with the Head tags on the HTML page?.
    Does this come down to personal preference or just better coding practices?.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by neonflorida View Post
    Hi.

    I was wondering if it is better practice to have your CSS as a seperate stylesheet or is it ok to have it included with the Head tags on the HTML page?.
    Does this come down to personal preference or just better coding practices?.
    my opinion:
    - external stylesheet, it's more easy to deal with it and html page is shorter
    - personal preference, I thing 'better coding practices' is a buzz word,

    best regards

  • #3
    Regular Coder
    Join Date
    Nov 2005
    Posts
    329
    Thanks
    3
    Thanked 19 Times in 19 Posts
    It really depends on whether your pages are styled differently each time or not. If you use one or two basic designs for several pages, it would make more sense to use external stylesheets. If each of your pages is different, it wouldn't, as then you would have to make an external stylesheet for each page. It is not a question of better or worse coding practices. However, if you use an external stylesheet to code a basic page, I suggest you first code it in the page itself. Once you have got it right and know it is what you want for the other pages, you can move the .css to an external stylesheet, if not it is quite annoying to have to open the external stylesheet each time you want to make a tiny change in the page.

    Cheers!

  • #4
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    As Avril said, if your design is consistant, external stylesheets are the way to go, as it reduces download times. More often than not, this will be the case.

  • #5
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,791
    Thanks
    8
    Thanked 131 Times in 129 Posts
    Quote Originally Posted by oesxyl View Post
    my opinion:
    - personal preference, I thing 'better coding practices' is a buzz word,
    I have so many not so funny to anyone else replies to that one. kudos.
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis


  •  

    Posting Permissions

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