Skip to main content
Inspiring
May 10, 2022
Answered

Name For CSS File

  • May 10, 2022
  • 2 replies
  • 620 views

Hi Guys,

I want to toss something out there for discussion.  Typically page related CSS is placed in a file called styles or something similar.  I'm a bit more picky.  Because of my programming and database background I like to compartmentalize my CSS.  To me styles are those page elements that have been given a name either by ID or Class.  There are still a bunch of others that are not given a name. body, html and the list continues.  I plan on putting those types of elements into their own CSS file but I'm gaving difficulty chosing a name for that file.  I would appreciate any suggestions you might have.   Thanks in advance.

This topic has been closed for replies.
Correct answer Nancy OShea

Filenames can be anything you wish, providing they meet standard HTTP naming conventions  -- no special characters.  I.e.  style.css, custom.css, special.css, monkeybutts.css, foo.css, etc...

 

CSS selector names are limited to:

  • standard HTML tags,
  • re-usable classes,
  • unique IDs
  • special usecase wildcards * and  > 

 

It would be counterproductive to carve out separate CSS files for each selector types as that would adversely increase HTTP server requests and delay page load.   For quicker loading web pages,  a single stylesheet is usually faster than several separate ones.  But there are exceptions. 

 

Google Chrome Developers had a recent discussion about this on YouTube.  Well worth watching BTW.

 

Is .css a bad idea?

 

2 replies

Nancy OShea
Community Expert
Nancy OSheaCommunity ExpertCorrect answer
Community Expert
May 10, 2022

Filenames can be anything you wish, providing they meet standard HTTP naming conventions  -- no special characters.  I.e.  style.css, custom.css, special.css, monkeybutts.css, foo.css, etc...

 

CSS selector names are limited to:

  • standard HTML tags,
  • re-usable classes,
  • unique IDs
  • special usecase wildcards * and  > 

 

It would be counterproductive to carve out separate CSS files for each selector types as that would adversely increase HTTP server requests and delay page load.   For quicker loading web pages,  a single stylesheet is usually faster than several separate ones.  But there are exceptions. 

 

Google Chrome Developers had a recent discussion about this on YouTube.  Well worth watching BTW.

 

Is .css a bad idea?

 

Nancy O'Shea— Product User & Community Expert
Legend
May 10, 2022

html_tags, maybe

Inspiring
May 10, 2022

Thanks for your suggestion.  I appreciate your input.