By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,492 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,492 IT Pros & Developers. It's quick & easy.

Naming used in HTML

P: n/a
seems interesting?

Q. Which naming convention for HTML stuffs you perferred?
e.g.

1. user-list.html VS userlist.html VS user_list.html

2.

<div id="main_content"... or <div id="mainContent".. or <div id="main-
content"..

have fun.

Mar 24 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
howa wrote:
Q. Which naming convention for HTML stuffs you perferred?
1. user-list.html VS userlist.html VS user_list.html
The telephone test applies. Ring up your girlfriend and tell her about your
brand new site:

user-list.html: userdashlist.html, userheiphenlist.html, userminus.html,
user_list.html.

user_list.html: userunderline.html, userunderscorelist.html, user-list.html.

userlist.html: userlist.html.
2.

<div id="main_content"... or <div id="mainContent".. or <div id="main-
content"..
Who cares, it's internal to your web page, not (normally) visible to the
viewer. Use whatever you want.

--
Richard.
Mar 24 '07 #2

P: n/a
Richard Formby wrote:
The telephone test applies. Ring up your girlfriend and tell her about your
brand new site:
I don't think it matters. "Go to example.com and click on the user list
link."
Who cares, it's internal to your web page, not (normally) visible to the
viewer. Use whatever you want.
Agreed. But I like 'main_content'. It is easier to read.
Mar 24 '07 #3

P: n/a
Scripsit Richard Formby:
>1. user-list.html VS userlist.html VS user_list.html

The telephone test applies. Ring up your girlfriend and tell her
about your brand new site:
My wife might get upset... The telephone test doesn't apply to _everything.

Besides, this is more about page (file) names than site names. My brand new
_site_ might be http://user-list.example.com but then I would probably want
to register http://userlist.example.com as an alias as well (and
http://user_list.example.com would probably be rejected by Dummy Inc., the
registrar for example.com).
user-list.html: userdashlist.html, userheiphenlist.html,
userminus.html, user_list.html.

user_list.html: userunderline.html, userunderscorelist.html,
user-list.html.
userlist.html: userlist.html.
So you recommend the last one, I presume. You have a point, but how often do
you read URLs aloud? I'd say Google matters more. Search engines generally
give much weight to the URL, and people will more probably use "user list"
(which matches "user-list" and "user_list" since Google treats special
characters as separators only) rather than "userlist" in their searches.
Google is a bit mystic in this area (it seems to treat "userlist",
"user-list" and "user list" as equivalent in some cases but not all), but I
would put my bet on the "user-list" horse.

Moreover, for long words, "user-list" style is more _readable_ than
"userlist", and people like to see a URL as a meaningful and readable string
even though they rarely pronounce them.

Between "user-list" and "user_list", it's difficult to decide. Using
"user-list" makes the URL breakable when it is rendered visibly (since
browsers may introduce a line break after "-"), but it looks more natural
than "user_list", which also suffers from the drawback that if underlined,
the underline is not always easy to distinguish from a space.
><div id="main_content"... or <div id="mainContent".. or <div
id="main- content"..

Who cares, it's internal to your web page, not (normally) visible to
the viewer. Use whatever you want.
As long as you are consistent. But actually, #main_content or some of the
other options _is_ visible to a user if someone links to that location on
your page. The id attribute values are potential destinations for links.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Mar 24 '07 #4

P: n/a
On 24 Mar, 07:02, "howa" <howac...@gmail.comwrote:
seems interesting?

Q. Which naming convention for HTML stuffs you perferred?
BE CONSISTENT!

BE CONSISTENT IN ANYWHERE THE USERS CAN SEE!!

HTML doesn't have much naming itself. HTTP and the HTML DOM are the
common requirements to start adding names to things.

HTTP is case-sensitive (unless made to be not so) It's also used by
people who don't understand this. So don't rely on it, don't make it
confusing and assume that all HTTP names will be entered in their
simplest and crudest forms. If you _start_ them out in this form, then
there's less space for error later.

Also punctuation characters are only going to confusing things for
data entry. My parents have sticky labels on their <Returnand <Tab>
keys, so how would you expect them to find a hyphen?

They _might_ make a domain name easier to read though. It can also
avoid the "powergenitalia" problem, where mis-reading is potentially
embarassing.
1. user-list.html VS userlist.html VS user_list.html
userlist.html
Also it's a good idea to avoid page names at all. Give your site a
sensible directory structure, use default pages throughout and don't
require users to ever remember or enter a URL that involves
remembering more than a domain name and simple directory name.

e.g. example.com/doggiechunks

rather than

example.com/competitions/default.asp?contest=doggiechunks_promo

(That 2nd is almost a real example, as printed on competition entry
forms by a major UK market-research aganecy)
Once they're inside the site and navigating by clicking links rather
than typing, then you have much more freedon.

<div id="main_content"... or <div id="mainContent".. or <div id="main-
content"..
DOM element names are used by programmers, for programmers. They're
not accessible to the punters beyond the 4th wall. So I'd suggest
camel case (look it up)

<div id="mainContent"..

Mar 26 '07 #5

P: n/a
Dan
On Mar 24, 3:22 am, "Richard Formby" <r...@invalid.comwrote:
The telephone test applies. Ring up your girlfriend
You're presuming the reader of your message has one?
user-list.html: userdashlist.html, userheiphenlist.html, userminus.html,
user_list.html.

user_list.html: userunderline.html, userunderscorelist.html, user-list.html.
userlist.html: userlist.html.
And maybe she'll add a superfuous "www." or ".com" somewhere in there
even if the actual URL doesn't have one, and perhaps at a point that
makes no logical or syntactic sense.

--
Dan

Mar 26 '07 #6

P: n/a
Dan
On Mar 26, 4:59 am, "Andy Dingley" <ding...@codesmiths.comwrote:
Also it's a good idea to avoid page names at all. Give your site a
sensible directory structure, use default pages throughout and don't
require users to ever remember or enter a URL that involves
remembering more than a domain name and simple directory name.
That kind of goes against the principles of logical structure I
generally espouse, where the directory structure should reflect
logical divisions of the site, in principle ones where there might be
lots of pages within the category eventually and hence an entire
directory makes sense rather than just a single file. If a
subdirectory is thought of as a drawer or shelf where items are
placed, one wouldn't want to allocate a separate drawer or shelf for
each little item; that seems awkward and wasteful.

Some thoughts on directory structure in Web sites: http://webtips.dan.info/subdir.html
e.g. example.com/doggiechunks
If that's a directory name, it would really be http://example.com/doggiechunks/
-- leaving out trailing slashes in directory names is one of my pet
peeves.

--
Dan

Mar 26 '07 #7

P: n/a
"Richard Formby" <rf@invalid.comwrites:
howa wrote:
>Q. Which naming convention for HTML stuffs you perferred?
>1. user-list.html VS userlist.html VS user_list.html

The telephone test applies. Ring up your girlfriend and tell her about your
brand new site:

user-list.html: userdashlist.html, userheiphenlist.html, userminus.html,
user_list.html.

user_list.html: userunderline.html, userunderscorelist.html, user-list.html.

userlist.html: userlist.html.
My personal domain fails that test *miserably*. Try explaining "dot-app.org"
over the phone some time...

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
Mar 26 '07 #8

P: n/a
On 26 Mar 2007 11:50:31 -0700, "Dan" <da*@tobias.namewrote:
>On Mar 26, 4:59 am, "Andy Dingley" <ding...@codesmiths.comwrote:
>Also it's a good idea to avoid page names at all. Give your site a
sensible directory structure, use default pages throughout and don't
require users to ever remember or enter a URL that involves
remembering more than a domain name and simple directory name.

That kind of goes against the principles of logical structure I
generally espouse, where the directory structure should reflect
logical divisions of the site,
It doesn't go against it. Have a directory structure that reflects
whatever you want, then overlay other entry points onto it by redirects.
in principle ones where there might be
lots of pages within the category eventually and hence an entire
directory makes sense rather than just a single file.
You never have to lose multiplicity here, just use a further level of
subdirectory.

You don't even have to have directories in the filesystem here --
they're just a virtual structure in the URL. You can map them however
you want through .htaccess
If a
subdirectory is thought of as a drawer or shelf where items are
placed, one wouldn't want to allocate a separate drawer or shelf for
each little item; that seems awkward and wasteful.
Directories aren't drawers. You can pack slices of a namespace very
closely indeed. You don't have to cut dovetails to make them either.
>e.g. example.com/doggiechunks

If that's a directory name, it would really be http://example.com/doggiechunks/
Of course it would really be that. However that's an acceptable user
input, the redirect takes care of it, and it's one less thing for the
user to have to get right.
>-- leaving out trailing slashes in directory names is one of my pet
peeves.
That's reasonable as a site authoring issue, unreasonable as a
requirement to force upon users.

--
Cats have nine lives, which is why they rarely post to Usenet.
Mar 26 '07 #9

P: n/a
On Sat, 24 Mar 2007, Jukka K. Korpela wrote:
people will more probably use "user list"
(which matches "user-list" and "user_list" since Google treats special
characters as separators only)
http://www.google.com/search?q=%22user+list%22
http://www.google.com/search?q=user-list
http://www.google.com/search?q=user_list

--
In memoriam Alan J. Flavell
http://groups.google.com/groups/sear...Alan.J.Flavell
Mar 27 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.