您的位置:首页 > Web前端 > HTML

What is  ? Is it needed?

2007-01-14 10:10 218 查看
  Short Answer   is the entity used to represent a non-breaking space. It is essentially a standard space, the primary difference being that a browser should not break (or wrap) a line of text at the point that this   occupies. Long Answer   is the entity used to represent a non-breaking space. It is essentially a standard space, the primary difference being that a browser should not break (or wrap) a line of text at the point that this   occupies. Many WYSIWYG HTML editors insert these   entities in an effort to control the layout of the HTML document. For example, such an editor may use a series of non-breaking spaces to indent a paragraph like this:
      This first line of text is supposed to be indented. However, many browsers will not render it as intended.

As the example mentions, some browsers will not, in fact, indent the text because of how that particular browser handles the   entity. Some browsers collapse multiple, concurrent non-breaking spaces into a single space. This sometimes happens, even if there are regular spaces separating the consecutive   entities. So keep in mind that this "technique" can not be relied on. There are some times when it is "acceptable" or "advisable" to use the   entity so long as the consequences are understood: It's intended use of creating a space between words or elements that should not be broken. The only problems that can be associated with this use is that too many words strung together with non-breaking spaces may require some graphical browsers to show horizontal scrollbars or cause them to display the text overlapping table borders. If you need to have an empty table cell, it is often advised that you add a non-breaking space like  . This is because some versions of Netscape seem to have problems with completely empty table cells. Indentation. It is generally discouraged to use a non-breaking space, or a series of non-breaking spaces to "force" an indentation. This practice is discouraged for two primary reasons. First, not all browsers handle the   entity properly and may in fact ignore it when rendering the document. Second, the practice of trying to "force" a specific presentation is often frowned upon as it tends to fail and/or makes it more difficult for some readers whose browsers may be configured differently from your own.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐