Numbering system for styles

I notice that when working on my website in Dreamweaver it assigns numbers to the styles but they don’t follow in ascending order one after another.

I will get say “style5” then maybe “style12” then into the 20’s but the numbers never follow the previous number as in 1,2 3, 4…
Is this by some design? It doesn’t seem to matter.

I also see looking at some source codes many sites are built without using say “style10” but style=“color:#B1AD67;font-size:13px;font-weight:bold;float:left;padding:0px 3px 0px 10px;” putting the style right at line its on. Which is preferred?

Not this:-

style="color:#B1AD67;font-size:13px;font-weight:bold;float:left;padding:0px 3px 0px 10px;"

Using in-line styling like this makes the html messy and makes maintaining the styling a nightmare.
It’s best to have a global external style sheet for the whole site.

I actually have no idea what you mean, but then I never used Dreamweaver.

1 Like

I’m guessing that Dreamweaver creates classes for you and names them things like .style5 and .style5, I think it’s best to give classes a meaningful name that describes what it’s for, like .menu .sidebar or .pullquote

1 Like

do the numbers correspond to the tags within the HTML that they apply to?

Yes for example most of the .style that are created are for fonts, colors and size so the example I showed before from someone’s source code would be set up as

.style5 {
color:#B1AD67;
font-size:13px;
font-weight:bold;
float:left;
padding:0px 3px 0px 10px;
}

I just expected if one was .style5 the next one set up would be .style6 but that is not the case.

Never use DW’s (WYSIWYG) design view in Dreamweaver and never let it auto generate code for you. On the other hand Dreamweaver’s ‘code editor’ is very good and you should use that instead and create your own style names and rules in the way that Sam already pointed out. Dreamweaver has no knowledge of what the styles it creates refer to and so has a numbering system set up which is totally unworkable once embedded in a page.

The sooner you drop design view and start working with the code itself the quicker your skills will improve and indeed things become a lot simpler. Believe me we’ve all been there and done that :slight_smile:

3 Likes

I think this is really just about how Dreamweaver works, it just labels them with numbers becuase it’s a piece of software and doesn’t really understand the purpose of the individual styles, so is incapable of giving them meaningful names.
The reality is, you can name styles however you like, in whatever order you like, it does not matter, though it makes sense to organise things neatly and logicaly. you could have .style6 {} .style47 {} .styleA {} .style2 {} .styleX {} style-council {} stylistics {} and it would not matter.
Just a few limitations, an id should never begin with a number, so you can’t have #4style.

Why? I would find these numbered styles very difficult to work with, having to remember what each one is for while editing. Hmm, .style236 what does that one do? Then having to search through html to find an instance of it being used to identify what element it’s used on. With a better name, you should know instantly what it’s for without even thinking about it.

1 Like

more a matter of which view in the software you use to do what.

Design View is rather useless and no professional would use it - it is only for novices who will accept any junk code as long as it looks okay before they upload it - after which it will probably look like junk in some if not all browsers.

All the professional level functionality is available by ignoring the existence of design view and just using the rest of the program.

Thanks everyone for the informative comments, not sure if it matters but I probably should have mentioned I am using a very old version of Dreamweaver (2009) back from before it was bought by Adobe.
I generally use split view and give a name to styles changing what Dreamweaver assigns, if they are something specific. But for fonts, headings in a color and such I have been just keeping what is placed. I suppose as they are assigned I could just change the number so they ascend in order. Also the page and coding is not that large so have not given much thought to changing a .style17 to say .smallfont-italic. I probably would if I used small font in italic numerous times.

Anyway it seems that re my original question of why Dreamweaver is assigning numbers not in sequence isn’t readily know and is not done for any reason.

Again, that’s not a good naming convention. What if a later site update changed all those instances to normal-sized bold text? It could get terribly confusing, trying to remember that the class smallfont-italic is what you need to use to achieve regular-sized bold text.

Choose your class names based on what it does or targets, not what it looks like.

4 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.