css stored where?

J

Jim S

Where is it conventional to store css files?
My html files are in the root directory and my images are in a folder in
that directory. Do I store my css files with the images or with the html
files?
Further to that I have a sub-web (my words) where there is a different site
with its own index.html. It too has css files and images folder so the
question arises again.
Or does it not matter?
 
J

Jonathan N. Little

Jim said:
Where is it conventional to store css files?
My html files are in the root directory and my images are in a folder in
that directory. Do I store my css files with the images or with the html
files?
Further to that I have a sub-web (my words) where there is a different site
with its own index.html. It too has css files and images folder so the
question arises again.
Or does it not matter?
Personal preference really. I use a /styles folder.
 
R

Rik

Jim said:
Where is it conventional to store css files?
My html files are in the root directory and my images are in a folder
in that directory. Do I store my css files with the images or with
the html files?
Further to that I have a sub-web (my words) where there is a
different site with its own index.html. It too has css files and
images folder so the question arises again.
Or does it not matter?

It does not really matter, allthough you preferably store the css files on
the same domain.
When you're using just one, the root will be fine. When you're using
several, you might want to make a different directory for them ('style' or
'css' or something like that), just to simplify keeping track of your
files.
 
D

dorayme

Jim S said:
Where is it conventional to store css files?
My html files are in the root directory and my images are in a folder in
that directory. Do I store my css files with the images or with the html
files?


Well, not with the images, why would you do that? If you have
just one or two sheets, just along with the html. If more, put
them in a folder, call it whatever. Everything depends on how
convenient you find it. On a large site with many sections and
folders, it is sometimes convenient to put in any css peculiar to
that section within that section. Again, either at the top of
that section or in a folder if there are a number of special css
sheets for that section.
 
T

the red dot

Jim S said:
Where is it conventional to store css files?
My html files are in the root directory and my images are in a folder in
that directory. Do I store my css files with the images or with the html
files?
Further to that I have a sub-web (my words) where there is a different site
with its own index.html. It too has css files and images folder so the
question arises again.
Or does it not matter?

i only have my index.html file in the root all other pages go in a folder
called html, images go in a folder called images, and css goes in a folder
called css. if you have another 'sub-site' that would go in a folder called
'whatever you want' and would then be laid out the same way as the main
site. i hope that makes sense.
 
K

kdarling

Jim said:
Where is it conventional to store css files?

Wherever you wish. Our group keeps the same directory structure for
each subgroup:

/html
/images
/css
/clientjs
/xsl
/tables (xml constants)
.. etc

So we know exactly where to go for each kind of file.

Kev
 
N

Neredbojias

Where is it conventional to store css files?
My html files are in the root directory and my images are in a folder
in that directory. Do I store my css files with the images or with the
html files?
Further to that I have a sub-web (my words) where there is a different
site with its own index.html. It too has css files and images folder
so the question arises again.
Or does it not matter?

I usually store mine in a sub-directory of the html directory called
"constantinoples_sardines_suck" just to relieve the boredom.
 
T

Toby Inkster

Jim said:
Where is it conventional to store css files?

On a publically-accessible web server. (Doesn't need to be the same server
as the pages themselves.)
 
A

Andy Dingley

Jim said:
Where is it conventional to store css files?

CSS is (generally) a site-wide shared feature, so store it somewhere
that's accessible with an equal path from a page anywhere on the site.
"/", "/styles/" or "/css/" all work fine. Just make sure you begin the
references to it with a "/" so that they're absolute.

Photos, in contrast, are usually bound to a particular page. So don't
have a "/photos/" directory, dumpe everything into it and have to worry
about a rats-nest of paths and refereneces from other pages. If you
have a few images used for "page furniture" (borders, rules etc.) then
_those_ can go in a site-wide directory called "/images/" etc., just
like the CSS

As always, keep the root directory clear. It's always easier to keep it
(or any similar directory) clear from the beginning than to fill it to
the unwieldy level, then have to try and move things out later.
 
J

Jukka K. Korpela

Scripsit Andy Dingley:
CSS is (generally) a site-wide shared feature, so store it somewhere
that's accessible with an equal path from a page anywhere on the site.
"/", "/styles/" or "/css/" all work fine.

That's fine site-wide stylesheets. Others might be put into topical
directories. The use of stuff like "/styles/" or "/css/" is common but
largely overkill. If you have a single site-wide stylesheet, you might just
as well put it into the main directory of your web pages. But if you have
several alternative stylesheets, perhaps divided into separate files for
technical reasons, and hopefully with documents that explain the
stylesheets, a subdirectory is a useful way to organize things.
Just make sure you begin the
references to it with a "/" so that they're absolute.

A URL that begins with "/" is by definition relative, not absolute, by the
Internet-standard on URL (URI) syntax. What matters is that it is relative
to the server root, not to the base URL of the referring document.
 
J

Jim S

CSS is (generally) a site-wide shared feature, so store it somewhere
that's accessible with an equal path from a page anywhere on the site.
"/", "/styles/" or "/css/" all work fine. Just make sure you begin the
references to it with a "/" so that they're absolute.

Photos, in contrast, are usually bound to a particular page. So don't
have a "/photos/" directory, dumpe everything into it and have to worry
about a rats-nest of paths and refereneces from other pages. If you
have a few images used for "page furniture" (borders, rules etc.) then
_those_ can go in a site-wide directory called "/images/" etc., just
like the CSS

As always, keep the root directory clear. It's always easier to keep it
(or any similar directory) clear from the beginning than to fill it to
the unwieldy level, then have to try and move things out later.

Are you saying that each page should have its own /images folder rather than
having all the images (photos in my case) in one folder?
 
A

Andy Dingley

Jim said:
Are you saying that each page should have its own /images folder rather than
having all the images (photos in my case) in one folder?

First of all, each page can't have its own "/images" directory. If it
begins with "/", it's root-relative (as Jukka correctly points out) and
there's only going to be one of them.

Nor ought it to have a "images" sub-directory, Not because it's wrong,
but because it's pointless. Keep your per-page images close to the
pages that use them, it's just easier to organise like that. "images"
sub-directories are one more level of hassle and they add nothing.
 
J

Jim S

First of all, each page can't have its own "/images" directory. If it
begins with "/", it's root-relative (as Jukka correctly points out) and
there's only going to be one of them.

Nor ought it to have a "images" sub-directory, Not because it's wrong,
but because it's pointless. Keep your per-page images close to the
pages that use them, it's just easier to organise like that. "images"
sub-directories are one more level of hassle and they add nothing.

Silly me, but it was not really what I meant.
At present all my html files (inc index.html) are in the root directory.
Also in there is a folder called 'images' where all the images live.
This must be the shortest path length, but it involves a fair bit of
searching for me since there hundreds of them.
 
A

Andy Dingley

Jim said:
At present all my html files (inc index.html) are in the root directory.

Then split your html files up into subdirectories. This has several
advantages:
- Smaller groups of related files are easier to manage (no more
"hundreds in a directory" clutter)

- Related groups can give you more structured URLs, such as
http://example.com/section1/
This also lets you skip the page name when you can just use a directory
and the default document (it's not the only way to do this, but it's
easy, convenient and a benefit of good structure)

- Root is cleaner, and there's a few magic files in there that you
might want to keep obviously visible, without clutter.

This must be the shortest path length,

Shortest path length is no path length
 
J

Jim S

Then split your html files up into subdirectories. This has several
advantages:
- Smaller groups of related files are easier to manage (no more
"hundreds in a directory" clutter)

- Related groups can give you more structured URLs, such as
http://example.com/section1/
This also lets you skip the page name when you can just use a directory
and the default document (it's not the only way to do this, but it's
easy, convenient and a benefit of good structure)

- Root is cleaner, and there's a few magic files in there that you
might want to keep obviously visible, without clutter.


Shortest path length is no path length

Thanks Andy. I'm sure you are right. I wish I had had this advice when I
started.
 
J

j_hawk1979

Jim said:
Thanks Andy. I'm sure you are right. I wish I had had this advice when I
started.


another way would be by creating a folder called css (best in lower
case)

it should be stored in where the html and image folder is....

ex:

(page.html)(page2.html) (images folder) (css folder)

when you call the css in your html coding.... don't forget to include
the folder plus name of the css...

Ex:

css/style.css

hope this helps...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top