Forum Moderators: not2easy

Message Too Old, No Replies

Silly question that google won't answer!

Valid commenting types

         

Matthew1980

8:24 pm on Oct 31, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello all!

I am just writing a new site from scratch, and it's been ages since I have needed to comment a css file, but the boss wants me to document in from the start, so I am just wondering about commenting types and style's that you use?

I know how to block comment, /**/ which works fine or me, but for single lines, I cannot remember how to do it, I always assumed as it was // but it turns out that this isn't right!

My own preference is just to block comment, and everyone has their own methods of doing this, so I thought I would ask.

Cheers,
MRb

Major_Payne

9:04 pm on Oct 31, 2010 (gmt 0)



For CSS, use: /* Your comments here */

For HTML, use: <!-- Your comments here -->

For many scripts, use: // Your comments here. Use for each line of comments.

Matthew1980

9:39 pm on Oct 31, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello there Major_payne,

Yes, cheers for that, I am just wondering if there is a way of doing a single line comment within css, as yet I can't seem to find one, and I just think that doing /**/ is a little excessive when you just want to comment one line.

Cheers,
MRb

milosevic

10:42 am on Nov 1, 2010 (gmt 0)

10+ Year Member



I don't believe there's a way to do commenting in CSS except with block format

Matthew1980

12:47 pm on Nov 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



^^^

Yeah I am beginning to think that this is the case. Not that it matters, I was just trying to keep commenting to a bare minimum.

Cheers,
MRb

Fotiman

1:49 pm on Nov 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Correct, there is only 1 type of comment within CSS (/* */). When in doubt, check the spec:
[w3.org...]

Matthew1980

9:53 pm on Nov 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Fotiman,

Yeah, makes sense I suppose, I now know why my css wasn't passing validation, I was hoping that there would be a simple *shortform* way of commenting, but never mind, I doubt as it affects any processing, as the browser ignores comments as any other language would.

Right, at least I know now, thanks for the link too.

Cheers,
MRb