CSS - Proper format?

G

Guest

Which is the correct format for a .css file?

h1 {
font-family: Arial;
font-size: 18pt;
color: #FFFFFF;
font-style: italic;
font-weight: bold
}

....or

h1 { font-family: Arial; font-size: 18pt; color: #FFFFFF; font-style:
italic; font-weight: bold }

....or something else entirely?? Does it matter? I want to be sure I'm
doing this the "normal" way.

Thanks,
-Sharon L.
 
P

P@tty Ayers

Both of those are correct. The line breaks don't matter. Some people find
the first way easier to keep track of; others would rather keep their style
sheet as brief and compact as possible, like the second.
 
S

Steve Easton

Either way. A computer sees it as one long data string no matter which way you do it

Because it's easier to see and edit, prefer:

h1 {
font-family: Arial;
font-size: 18pt;
color: #FFFFFF;
font-style: italic;
font-weight: bold
}

Also, if you use a program such as TopStyle, it writes as shown above.

And Also, you forget the closing semi colon after font-weight: bold
it should be font-weight: bold;

;-)

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed..................
...............................with a computer
 
G

Guest

Thanks everyone. :) I suspected as much, since I'd seen it both ways, but I
wanted to make sure.

-Sharon L.
 
M

Murray

It is acceptible to omit that last semicolon. The problem is when you are
running on as few neurons as I have, and you omit that last semicolon, then
when you come back to the rule to add a new style, you forget that you
omitted the semicolon, and wind up with invalid syntax, doncha know?
 
S

Steve Easton

You mean you still have some neurons left !!

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
G

Guest

Is there a "Best CSS Editor" to use since FP 2003 is a bit limited I have
found, and will the next version have a better editor?
I really dont want to buy another editor if the next version will ahve all
the features I want.
 
T

Trevor L.

Not that it matters (the semi-colon, that is).

I hesitate to appear to be criticising an MVP, but the closing semi-colon at
the end of a string of definitions (or whatever you call them) in a style
statement is not necessary, is it ?

Just as HTML statements do not need semi-colons, unless there is another
statement on the same line.

That is, as I read it, semi-colons are not statement *terminators*, but
statement *separators*. And a new line serves as a separator (at least for
statements, maybe not in the definition of a style).

Please enlighten me if I am wrong. I learnt my trade on completely different
computers - mainframes, or more lately in my career, on Unix boxes. And I
certainly knew nothing about HTML/CSS/Javascript until 7 months ago,

:)
 

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

Similar Threads


Top