View previous topic :: View next topic |
Author |
Message |
raven
Joined: 31 Jan 2006 Posts: 41
|
Posted: Tue Jan 31, 2006 6:04 pm Post subject: Internal or External CSS |
|
|
I would guess almost everyone uses external CSS files to include their css with their webpages. That being said I still see people including them in the code itself. In fact I came across an otherwise really nice portal script called MKPortal that used to include the CSS right in the code. It made for extremely bloated pages.
Is there ANY reason for not putting CSS in an external file? _________________ Programmers do it in code |
|
Back to top |
|
|
raven
Joined: 31 Jan 2006 Posts: 41
|
Posted: Wed Feb 01, 2006 2:09 am Post subject: |
|
|
I did some research to answer my own question but thought I would go ahead and share it:
The C in CSS is for "Cascading" and the closer to an element the style definition is the more prominent a role it plays.
The only really good reason for inline style is to override a style defined at a higher level. If you find this being done repetitively for the same reason then it is probably a good idea to go with a class or id definition instead. _________________ Programmers do it in code |
|
Back to top |
|
|
x-raysteve
Joined: 01 Feb 2006 Posts: 53
|
Posted: Sat Feb 04, 2006 5:07 am Post subject: |
|
|
I do not know of any real good reason not to use an external file. It gives you a lot more flexibility when managing your attributes. You can even share files between different pages, which is very common. Sure you could include it in a header file, but that is much less clean, and actually bloats your source. |
|
Back to top |
|
|
Stitch
Joined: 07 Feb 2006 Posts: 43
|
Posted: Thu Feb 09, 2006 10:58 pm Post subject: |
|
|
If you just have 1 page running off of that stylesheet, then you might as well have it be internal.
If you have multiple pages running off of one stylesheet then you should have it be external and have all the pages link to it. That way your code will be cleaner, and your site will load much more quickly. |
|
Back to top |
|
|
ComDriver
Joined: 06 Mar 2006 Posts: 8
|
Posted: Mon Mar 06, 2006 5:47 pm Post subject: |
|
|
I use an external style sheet, it keeps my code tidier and it means I don’t have to go to every page in my site and change one ting detail, I can just change it in the external style sheet and bingo, I’ve got a uniform look across every page in my site. |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Mon Mar 06, 2006 8:55 pm Post subject: |
|
|
I always use external CSS file. I hate to make changes in several places, when one will suffice _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
rose
Joined: 21 Feb 2006 Posts: 29
|
Posted: Tue Mar 07, 2006 5:15 am Post subject: |
|
|
Yes, it just creates more work if you do it internally.
Usually I will develop one page with internal CSS.
Then when I have finished the development, I will ship that over to an external file to make for easy changes later on:) |
|
Back to top |
|
|
bongo
Joined: 07 Mar 2006 Posts: 11
|
Posted: Tue Mar 07, 2006 12:43 pm Post subject: |
|
|
i actually used to using internal css even though i'm making lots of web pages. It's not much trouble after all as you can copy and paste for the rest of the pages too.. |
|
Back to top |
|
|
James
Joined: 20 Feb 2006 Posts: 24
|
Posted: Fri Mar 10, 2006 12:08 am Post subject: |
|
|
But what happens when you want to amend something in the CSS?
You then have to go through every single page to do this. It's very tedious.
yes you can use a search and replace function, but why bother when it can be done in one shot with an external file? |
|
Back to top |
|
|
administrator Site Admin
Joined: 01 Oct 2004 Posts: 183
|
Posted: Fri Mar 10, 2006 10:24 am Post subject: |
|
|
I think we all agree that the external CSS is the way to go. I'm closing this thread. _________________ Peter
ASP & ASP.NET Articles and Tutorials |
|
Back to top |
|
|
|