Hello,

I'm relatively new to CSS and am interested to know if it's generally better to implement CSS internally or externally, the pro's and con's if there are any of course!

Recommended Answers

All 5 Replies

Externally. Why?
Let's say your site has 50 pages using the same basic styles. If your styles are internal, they'll have to be hard coded into each individual page. That means that if you visit 10 pages in the site, the styles will have to be downloaded all 10 times. If you'd have used an external stylesheet, the styles would get downloaded once, loaded into the cache, and reused for each page.
Also, if you decide to change up the style of something like your navigation bar or footer, you'll only have to change it once instead of 50 times.

Externally. Buddylee hit it square on the head.

For you, it'll mean much less coding. (And/or copying and pasting). If you code externally, you just need one stylesheet, where everything will be located. You can link it to all your webpages by adding a link in the <head> tags.

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

It also helps with organization. You'll have less coding in your web pages (+1). Like said before, you'll have everything in one file.

As others have said, External style sheets are your best method for designing a website.

1) You don't have to edit multiple places to change styles.
2) It allows you to have pages appear differently based on which style sheet is loaded - perfect for dynamic websites.
3) Reuse your code easily.
4) Further separates your code from your presentation.
5) It's a good habit to get into based on Rule 4. You should always code once, and reuse it.

Hi,

Thanks guys for the feedback, I've tested both methods and i must say having separate style sheets works best not to mention all the time i save!

guess it's a no-brainer!

Yeah it's faster to change something on your website, just change one file and all your pages are changed, as stated above.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.