fix typos, grammar (#31259)
This commit is contained in:
committed by
Randell Dawson
parent
d450f06c5d
commit
1d8cb898db
@ -3,7 +3,7 @@ title: Comments in HTML
|
||||
---
|
||||
## Comments in HTML
|
||||
|
||||
The comment tag is an element used to leave notes, mostly related to the project or the website. This tag is frequently used to explain something in the code or leave some recommendations about the project. The comment tag also makes it easier for the developer to come back and understand the code he's written at a later stage. Comments can also be used for commenting out lines of code for debugging purposes.
|
||||
The comment tag is an element used to leave notes, mostly related to the project or the website. This tag is frequently used to explain something in the code or leave some recommendations about the project. The comment tag also makes it easier for the developer to come back at a later stage and understand the code he's written earlier. Comments can also be used for commenting out lines of code for debugging purposes.
|
||||
|
||||
|
||||
It is good practice to add comments to your code, especially when working with a team or at a company. It is also important that you write clear and concise comments that another developer could easier understand.
|
||||
@ -21,19 +21,18 @@ Comments are started with `<!--` and ended with `-->`, and can span multiple lin
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h1>FreeCodeCamp web</h1>
|
||||
<!-- Leave some space between the h1 and the p in order to understand what are we talking about-->
|
||||
<p>FreeCodeCamp is an open-source project that needs your help</p>
|
||||
<!-- For readability of code use proper indentation -->
|
||||
</body>
|
||||
<body>
|
||||
<h1>FreeCodeCamp web</h1>
|
||||
<!-- Leave some space between the h1 and the p in order to understand what we are talking about-->
|
||||
<p>FreeCodeCamp is an open-source project that needs your help</p>
|
||||
<!-- For readability of code use proper indentation -->
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
## Conditional Comments
|
||||
Conditional Comments define some HTML tags to be executed when a certain condition is fulfilled.
|
||||
|
||||
Conditional Comments defines some HTML tags to be excuted when a certain condition is fullfilled.
|
||||
|
||||
Conditional Comments are only recognized by Internet Explorer Version 5 through to Version 9 (IE5 - IE9).
|
||||
Conditional Comments are only recognized by Internet Explorer Version 5 through Version 9 (IE5 - IE9).
|
||||
|
||||
Older IE versions often need additional CSS to display your pages accurately. Conditional comments can fulfill this purpose.
|
||||
|
||||
@ -44,7 +43,7 @@ Older IE versions often need additional CSS to display your pages accurately. Co
|
||||
<body>
|
||||
<!--[if IE 9]>
|
||||
<h1>FreeCodeCamp web</h1>
|
||||
<p>FreeCodeCamp is an open-source project that needs your help</p>
|
||||
<p>FreeCodeCamp is an open-source project that needs your help</p>
|
||||
<![endif]-->
|
||||
</body>
|
||||
</html>
|
||||
@ -52,12 +51,12 @@ Older IE versions often need additional CSS to display your pages accurately. Co
|
||||
|
||||
### IE Conditional Comments
|
||||
|
||||
These comments are only available in Internet Explorer and can be used up to IE9. In the current times, there is a good chance you will never see them, but it is good to know about their existence. Conditional Comments are a way to serve a different experience for different client browsers. For example:
|
||||
These comments are only available in Internet Explorer and can be used up to IE9. There is a chance you will never see them, but it is good to know about their existence as they do exist on some older sites. Conditional Comments are a way to serve a different and/or optimal experience for different client browsers. For example:
|
||||
|
||||
```html
|
||||
<!--[if lt IE 9]> <p>Your browser is lower then IE9</p> <![endif]-->
|
||||
<!--[if lt IE 9]> <p>Your browser is lower than IE9</p> <![endif]-->
|
||||
<!--[if IE 9]> <p>Your browser is IE9</p> <![endif]-->
|
||||
<!--[if gt IE 9]> <p>Your browser is greater then IE9</p> <![endif]-->
|
||||
<!--[if gt IE 9]> <p>Your browser is greater than IE9</p> <![endif]-->
|
||||
```
|
||||
|
||||
|
||||
@ -77,10 +76,9 @@ For example, this CSS would only apply on IE 7 / 8:
|
||||
```
|
||||
|
||||
#### Tip
|
||||
**CTRL + /** is a keyboard shortcut which works in probably all modern text editors to create the comments. It creates a single line comment, but if you want to comment more lines, just highlight all the area and press it.
|
||||
**CTRL + /** is a keyboard shortcut which works in probably all modern text editors to create the comments. It creates a single line comment, but if you want to comment more lines, just highlight all the area and press it.
|
||||
|
||||
#### More Information
|
||||
* [About conditional comments](https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx)
|
||||
* [Some IE CSS bugs](https://css-tricks.com/ie-css-bugs-thatll-get-you-every-time/)
|
||||
* [IE CSS bugs and fixes](https://code.tutsplus.com/tutorials/9-most-common-ie-bugs-and-how-to-fix-them--net-7764)
|
||||
|
||||
|
Reference in New Issue
Block a user