Html Comments

Comments are parts of the code that are ignored by a browser. To explain and define section parts of a document to others who see the code, it's a good practice to add comments to your HTML code. Especially in complex documents. To increase the readability of the code and help others understand the code, then comments are very useful.

Texts and content placed between these <! - ... -> tags are handled as a comment and will be completely ignored by the browser.


Single Comments in HTML

When the comment span over one line the comment should be placed in between the start tag <!-- and the end tag -->. All content that is placed between these tags will be treated as comments and will therefor be ignored by the browser.

HTML - Single Comments in HTML

<!DOCTYPE html>
<html>
    <head>  
        <title>Comment over one line</title>
    </head>   
        <body>
            <!--Comments that span over no more than one line are called a single line comment.-->
            <p>Some even better story goes here.</p>
        </body>
</html>

Multiline Comments in HTML

It's possible to comment on several rows with the special start tag <!-- - and the end tag -->. The first tag is placed before the first line and the end tag is placed in the end of the last line. The following example illustrates it.

HTML - Multiline Comments in HTML

<!DOCTYPE html>
<html>
    <head>  
        <title>Comment over more than one line</title>
    </head> 
     
        <body>
            <!-- 
              Comments that span over more than one line
              is called a multiline comment.
            -->
            <p>Some nice story goes here</p>
        </body>
</html>

Debugging - Comment out Code

It can be very useful to be able to comment out you code during testing. It helps you when you try to find error in the code.
HTML - Debugging - Comment out Code

<!DOCTYPE html>
<html>
    <body>
        <!-- Hide this during debugging
          <p>Why comments can be good to use during debugging the code.</p>
        -->
    </body>
</html>

Comment out Script Code

If you use Java Script and VBScript in the HTML code, you can place the script code in correct HTML comments to make sure that also old browsers work properly.

HTML - Comment out Script Code

<!DOCTYPE html>
<html>
    <head>
        <title>Commenting Script Code</title>
        <script>
        <!-- 
          document.write("My nice friend Johnny is swimming")
        -->
        </script>
    </head>
    <body>
        <p>Hello , Johnny!</p>
    </body>
</html>

Comment out Style Sheets

When using Cascading Style Sheet (CSS) in the HTML code, it is recommended that you type that code in real HTML comments to ensure that old browsers work properly.

HTML - Comment out Style Sheets

<!DOCTYPE html>
<html>
    <head>
        <title>Commenting Style Sheets in HTML</title>
        <style>
        <!--
          .example {
              border: 3px solid;
          }
        -->
        </style>
    </head>
        <body>
    <div class = "example">Hello , Johnny! Dinner is served.</div>
    </body>
</html>

BACK TO TOP






Check this out

HTML: Responsive Web Design

What are we talking about when we are talking about responsive design?


To say it simple.
When using responsive web design the goal is to make your web page look good on all kind devices.

It's all about using HTML and CSS to automatically resize, hide, shrink, or enlarge ....

HTML: Media Youtube

Play video on your page by using YouTube - probably the easiest way to play video.

Embedding a video into a web page used to be a real pain. There was different file formats, visitors could not have the proper software installed, bandwidth could be limited.

Embedding a video onto ....

HTML: Layout

When you develop a webpage, it is very important to think about the layout and what the page should look like. This is important for the entire user experience and for the user-friendliness of the page.


Nowadays, it's common and highly recommended to use modern technologies such as CSS....

HTML: Multi Media

Multimedia is almost everything you can see or hear.

Multimedia can be: Video, Film, Animation, Music, Sound and Image.

HTML5 gives a new standard for how to embed multimedia on a web page.
It is possible to have many different multimedia elements on a web page.


BACK TO TOP
HTML is a markup language used to make web pages. HTML5 is the latest version of Hypertext Markup Language. The cornerstone technologies for a webpage are HTML, which provides the structure. Cascading Style Sheets (CSS), which take care of presentation. And JavaScript, which makes things happen.

Thanks to HTML5, web pages can now store data locally on the users browser, then you dont need to use HTTP cookies. Now content can be delivered faster and more securely. HTML5 has also made it easier to ensure consistency across all browsers. Since browsers have traditionally relied upon different plugins to play multimedia files, native support of video and audio allows developers to avoid compatibility issues. New attributes also allow for video controls including play, pause, and volume options.

HTML4 was the standard for about 15 years and many still use it, all browsers will continue to support it for a very long time. Likewise, older browsers can 'overlook' new HTML5 code while rendering content. Virtually all modern browsers support HTML5 specifications fairly well.

You can use HTML5test to run a test with your current browser to see what it scores in terms of HTML5 support.

BACK TO TOP

Need more Honney

NDC Conferences

The NDC Conferences (Norwegian Developers Conference) are one of the world`s largest independent software conferences for .NET & Agile development. The conference covers everything you need to know within software development. The conferences are held each year in many places such as Oslo, Copenhagen, London, Sydney and Minnesota.

Update Conference Prague

Update Conference Prague is the biggest developer conference in the Czech Republic. The conference is offering sessions delivered by the top experts from all around the world. Their goal is to inspire the attendees and enrich their knowledge.

Troy Hunt

Learn about Web Security from Troy Hunt. He is a really engaged speaker that frequently give talks on conferences around the world. Troy is a Microsoft MVP and you can even learn from him on some great courses on Pluralsight.

W3Schools

W3Schools.com is a great education Web Site for learning web technologies. On W3Schools you may find well organized basic to advanced tutorials and references.

Scott Hanselman

Learn about Web Technologies and new trends from Scott Hanselman. Scott Hanselman is an author of developer books and he is an engaged speaker that usually talks about the Microsoft stack. You may meet Scott on conferences around the world.

Developer Week

DeveloperWeek is one of the world’s largest developer conferences. Developer Week focus on new dev technologies, the conference have talks and workshops for newbies and experienced audience. You can attend on a Developer Week conference different places in Nothern America.


BACK TO TOP

Honneybag blog



Learn JavaScript Debugging

Searching for bugs and fixing them is called code debugging. The bugs might be difficult to diagnose and therefore it is important to have a good approach to find and fix the bugs effectively. Bugs in the code might be syntax errors or logical errors. Sometimes nothing happens when the code contains bugs and there is few indications where to search. Modern web browser includes a powerful suite of developer tools. The tools do a range of things...

Explore JavaScript Arrays

Arrays are frequently used by developers. Programming languages can have slightly different implementation of arrays. An array is an object that can store a collection of items. You may say it`s a special variable that can have more than one value. The array holds many values under a single name, and you may access the values by referring to an index number. The easiest way to create....

Ultimate Guide to HTML Colors

It is essential to give the user a good user experience. There are many things you should focus on, one of them is how you use colors on your website. We don't have to struggle with black and white TVs anymore. Users expect more and more and we can apply colors to everything we want. Texts, borders, backgrounds, shadows – in HTML they all can have whatever color you decide....

Wanna be a sheep? Check out the most popular subjects
HONNEYBAG BLOG
HONNEYBAGBLOG INSPIRE-AND-BE-INSPIRED
HTML FORMATTING
HTML ESSENTIALS
JAVASCRIPT ESSENTIALS
Wanna be a little different? Check out the less popular subjects
HONNEYBAG BLOGER
HTML INTRODUCTION
HTML ESSENTIALS
JAVASCRIPT BREAKER
HTML BUILDING-BLOCKS
BACK TO TOP