Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635

    CSS -- Internal vs External -- Speedwise


    Is there any difference in speed for an internal style sheet vs an external one?

    I've putting all the styles withing each page dynamicly from one source, because of themes and the want to change some styles from one place only it has to be done. Is there is a better way then internal style?

    With external there is the plus of having it cached, and I could have the style.css be parsed by php instead, would this be better?
  2. #2
  3. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    absolutely no difference whatsoever - providing the external CSS file is on your machine.

    if you use external CSS then it is loaded and then the page is formatted. If you use internal the CSS is loaded with the page. Either way you have the same amount of CSS code. Loading the external file in may add a millisecond or two. A big point of CSS is that it should really be used with external sheets, otherwise its kind of defeated, fair enough you would have more control with CSS than font tags but you would still have to go into every page and change them if internal.
  4. #3
  5. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    ya but each page is dynamic php all going to be read mostlikly from a db so everything will be changed from one place (but is just weird ) anways thanks for the input.
  6. #4
  7. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    im not getting what you are doing? why are you putting CSS definitions in a database? Just use external CSS files and then call then with LINK REL=stylefile.css .......
  8. #5
  9. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    apologies if I have totally the wrong end of the stick
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    city of sin, state of the art
    Posts
    421
    Rep Power
    0
    Originally posted by ralphuk100
    absolutely no difference whatsoever - providing the external CSS file is on your machine.

    if you use external CSS then it is loaded and then the page is formatted. If you use internal the CSS is loaded with the page. Either way you have the same amount of CSS code. Loading the external file in may add a millisecond or two. A big point of CSS is that it should really be used with external sheets, otherwise its kind of defeated, fair enough you would have more control with CSS than font tags but you would still have to go into every page and change them if internal.
    Agreed.

    some ppl say that the externals would be faster because the are only loaded once and then they are there. but even if they werent i would stillll stick with the externals...it makes it soooo much more flexible and easier and faster (in the design time sense) and it just makes for a good time.

    haha serisously...the time difference isnt calculable and the advantages of externall exceed internal by sooooo much its only worth doin it once...use external.

    ROCK ON!!
  12. #7
  13. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    well I would (and have on other sites) used external ones, let me try to explain what needs to be done.

    There are themes, say 5 of them (there can be unlimited), within each theme is 3 stylesheets, large medium and small. To make a single change across multiple themes you'd need to edit 15 css files (say the a class(tag) which isn't affected by size) this is something the manager of the site doesn't want to have to do, he wants to edit the a tag in one spot and it affect all the themes.

    Hope it's explained better if not just say so.
  14. #8
  15. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    read other post
  16. #9
  17. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    are your pages dynamic? (php/asp?) you could just do:

    $themeTypeSize = $_GET['themeTypeSize'];

    <link href="<?=themeTypeSize?>.css" rel="stylesheet" type="text/css">

    But putting CSS files into a database just is not a good idea from any way I look at it.
  18. #10
  19. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    aah - I see what you mean. What you should be doing is having a generic.css and then a themefile.css - every page should load generic.css and then the themefile.css can be dynamic - either called through cookie (if the users theme is saved), or just through the querystring etc.
  20. #11
  21. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    how can you add the second css? I mean can you do.
    <link href="generic.css" rel="stylesheet" type="text/css">
    <link href="theme1.css" rel="stylesheet" type="text/css">
    ?
  22. #12
  23. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    yes, you can include as many css files as you want. They are just like server side includes
  24. #13
  25. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    you did not say if your pages were html? or a server side language such as asp/php?

    if the latter I would recommend making the theme style file name a variable and then calling that file with something like:

    <link href="<?=themeTypeSize?>.css" rel="stylesheet" type="text/css">

    but its up to you - im off to be now so wont be replying for the next 10 hours or so sorry.
  26. #14
  27. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    city of sin, state of the art
    Posts
    421
    Rep Power
    0
    this probably isnt what u mean...but sure, u can reference more then one css file...i think the tags have to be different though...other wise....i dunno...that would seem to make a mess...never tried it like that.

    hmmm.
  28. #15
  29. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    I'm using php so ya I'll do something like that, thanks guys for all your help
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo