We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
Comments?
Topic Started: Jan 11 2005, 04:21 PM (791 Views)
Hero_of_time
I love Emily :wub:
[ *  *  *  * ]
Ok, we all know (or all should know), that to comment out something in an HTML document it's:
<!--something-->

And, when adding a comment, it does NOT show up on the page (and if you comment out code, the code doesn't work)... so my question is, how come on some pages I've viewed the source of, their CSS is wrapped in comment tags, but yet the CSS still works on the page?
How come the CSS isn't "invisible" to the browser? and what's the point/advantage/disavantage of wrapping the CSS in comment tags?
Offline Profile Quote Post Goto Top
 
Maelroth
Member Avatar
Keeping an eye on you
[ *  *  *  *  * ]
Different make up language? maybe the comment tag only works in html and java script as far as i know
Offline Profile Quote Post Goto Top
 
Gornakle
Member Avatar
Member
[ *  *  *  *  * ]
The code ignores those comment tags. The reason why they're there is so older browsers that don't support CSS will not be able to view it (otherwise, the whole stylesheet will be displayed on screen).
Offline Profile Quote Post Goto Top
 
Hero_of_time
I love Emily :wub:
[ *  *  *  * ]
Gornakle
January 11, 2005 04:38 PM
The code ignores those comment tags. The reason why they're there is so older browsers that don't support CSS will not be able to view it (otherwise, the whole stylesheet will be displayed on screen).

Oh ok, thanks!
Offline Profile Quote Post Goto Top
 
korn_mosher_4life-ZNS
the korn mosher 4life
[ *  *  *  * ]
dont forget // and /*...*/ easier then trying to remember <!--....-->

.....for me anyways.
Offline Profile Quote Post Goto Top
 
Deleted User
Deleted User

Those only work within script tags, don't they? :unsure:
Quote Post Goto Top
 
Cool Dude 2k
Member Avatar
<?php echo "Linux"; ?>
[ *  * ]
PhranK
January 12, 2005 02:06 AM
Those only work within script tags, don't they? :unsure:

/*...*/ also works in style tags and CSS Files. :P
Offline Profile Quote Post Goto Top
 
Deleted User
Deleted User

Well.. you learn something new every day! :)

By the way, you spelled respect wrong in your sig, unless you meant repect list? :stefan:
Quote Post Goto Top
 
Rory
Member Avatar
i;m a mess
[ *  *  *  *  *  *  * ]
<!-- and --> only work in HTML.

//

and

/* */

work in css (javascript as well?)

if you are using <!-- --> in your css, then it won't hide the code (i'm pretty sure).
Offline Profile Quote Post Goto Top
 
Ali-ZNS
Member Avatar
Member
[ *  *  *  *  *  *  * ]
Rory
January 12, 2005 07:47 AM
//

and

/* */

work in css (javascript as well?)

if you are using <!-- --> in your css, then it won't hide the code (i'm pretty sure).

Yes, you're indeed correct. With JavaScript single line comments are made with the // characters. So for example, for a single line comment on a section of JavaScript coding I could use:
Single Line Comment
 
if (document.images) //Defines the area of where the mouse over effects will be defined.

And the /* */ characters are made for multi-line comments. For example:
Multi-line Comment
 
<script language="javascript">
<!--

/*
======================
| SCRIPT INSTALLATION
======================

*/
JavaScipt Code Here
//-->
</script>

As for hiding the codes in CSS using HTML comment tags (<!-- CODE HERE -->), then no, that doesn't hide the code. It's used for commenting and is still visable via page source unless some sort of script is implanted on the webpage that messes with viewing page source via a persons browser.

Ali
Offline Profile Quote Post Goto Top
 
Renee S
Renée S
[ * ]
PhranK
January 12, 2005 04:16 AM
<!-- and --> only work in HTML.

//

and

/* */

work in css (javascript as well?)

if you are using <!-- --> in your css, then it won't hide the code (i'm pretty sure).

Cool dident know that. B)
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
// does not work in CSS, only /*

And if you put <!-- --> in your CSS files, they WILL NOT VALIDATE. This is wrong and bad.

<!-- --> HTML
// JS
/* */ JS, CSS
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
Gornakle
January 11, 2005 02:38 PM
The code ignores those comment tags. The reason why they're there is so older browsers that don't support CSS will not be able to view it (otherwise, the whole stylesheet will be displayed on screen).

Older browsers will not see the styles anyways as long as they are within your <head>. Or use @IMPORT or <link rel /> to be even safer.
Offline Profile Quote Post Goto Top
 
Renee S
Renée S
[ * ]
Seth
January 13, 2005 08:17 PM
// does not work in CSS, only /*

And if you put <!-- --> in your CSS files, they WILL NOT VALIDATE. This is wrong and bad.

<!-- --> HTML
// JS
/* */ JS, CSS

I thought that // did not work in CSS but i was not too sure. Thanks for telling me Seth. :wub:
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
:wub:

:rofl:
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Technology Chat · Next Topic »
Add Reply
  • Pages:
  • 1