Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How do you hide text in HTML?

I want to organize my script a little. Say I wanted to put "First Name Input" but not show it. Do you use the <!-- First Name Input -->?

Thanks

4 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    By placing text inside these parameters <!-- My Text --> it means the text will not show on a standard browser view. However, if you view the same page but in Source view then it will be viewable.

    The idea of using this method is for 'commenting' in HTML code, and allows developers to add code to parts of their coding easier, or if you are designing a website/webpage for someone else, then they can see where their content should be placed. Basically, a placdeholder for code to be inserted.

    It is not used to hide text inside HTML documents, since comments like this can be spidered and indexed by search engines. It's common practice to remove comment tags from any webpage for SEO purposes.

  • Anonymous
    5 years ago

    May be you can call a function in java script when the form is submitted, to check if that text field is empty. If it is empty, you can enter your default text and then submit the form from your javascript.

  • Anonymous
    1 decade ago

    The comment tags you used are fine. Also you can do it in a paragraph:

    <p>Only this <span style="visibility: hidden;">word</span> will not show.</p>

    Ron

  • 1 decade ago

    in html markup you can use the notation you provided.

Still have questions? Get your answers by asking now.