简体   繁体   English

什么是以及如何摆脱它

[英]What is ­ and how do i get rid of it

I have noticed, while looking at my page source, the characters &shy;我注意到,在查看我的页面源代码时,字符&shy; showing just after a <div> tag.显示在<div>标签之后。 I went trough my coding and can't find where it is from;我完成了我的编码,但找不到它的来源; I did some research and they are saying that it is there so words can be cut.我做了一些研究,他们说它在那里,所以可以减少文字。

Near the <h1> tag I have a floating image that is a little bit bigger than the title.<h1>标签附近,我有一个比标题大一点的浮动图像。 I was wondering if that was causing it since I could extend the title on a second line because of the floating image but it remains.我想知道这是否是导致它的原因,因为我可以由于浮动图像而将标题扩展到第二行,但它仍然存在。

How do I get rid of it?我该如何摆脱它? Why is it there?为什么会在那里?

Here is what the source looks like:这是源的样子:

<div class="container">
&shy;
<img src="floating_right.png">
<h1>Title</h1>
<div class="more stuff"> eventually justified text</div>
</div>

Any clues?有什么线索吗?

EDIT编辑

This is my actual code;这是我的实际代码;

 echo '<div id="inputTag">­';
    echo '<img id="winClose" class="btn_close" src="http://images/html/bouttons/fermer.png" alt="Fermer">';
 echo '<h1>'.$titre.'</h1><br>';

I might also mention that I am using Webmatrix 3.我可能还会提到我正在使用 Webmatrix 3。

EDIT编辑

To fix this I have opened the file in Notepad++ and there it was;为了解决这个问题,我在 Notepad++ 中打开了这个文件,它就在那里;

echo '<div id="inputTag">-­';

Voila!瞧!

This script will find and remove all the invisible &shy; 这个脚本会找到并删除所有看不见的&shy; s on your page: 在您的页面上:

document.body.innerHTML=document.body.innerHTML.replace(/\u00AD/g, '');

It works by searching for the Unicode character U+00AD . 它的工作原理是搜索Unicode字符U+00AD It's invisible when it doesn't sit at a line break, which is probably why you can't find it in your code. 当它不在换行符时它是不可见的,这可能是你在代码中找不到它的原因。

Soft hyphen ( shy ) This character is not rendered visibly; 软连字符( 害羞 )此字符不会明显呈现; instead, it suggests a place where the browser might choose to break the word if necessary. 相反,它建议一个浏览器可能会选择在必要时打破这个词的地方。 In HTML, you can use to insert a soft hyphen. 在HTML中,您可以使用插入软连字符。

A quick Google search showed this: Google快速搜索显示了这一点:

https://en.wikipedia.org/wiki/Soft_hyphen https://en.wikipedia.org/wiki/Soft_hyphen

Basically, it's a - I think. 基本上,这是 - 我认为。 I would recommend looking for a - on your web page. 我建议你在网页上找一个 - 。 If you don't see one I wouldn't recommend bothering with it unless you wanna use jQuery and make a simple script that'll remove it. 如果你没有看到一个我不建议打扰它,除非你想使用jQuery并制作一个简单的脚本,将删除它。

EDIT 编辑

It seems you want to get rid of it. 看来你想要摆脱它。 I'd recommend trying to move around your images and play with them a little until it goes away. 我建议您尝试移动图像并稍微玩一下,直到它消失。

You can safely get rid of the tag in the example you have posted. 您可以安全地删除已发布的示例中的标记。 &shy; is known as the soft hyphen and is used to break words up across multiple lines in web pages. 被称为软连字符,用于在网页中的多行中分隔单词。 You would normally expect to see it in the middle of really long words in a paragraph the same as you would hyphenate a long word in a written paragraph to space it over two lines in case you run out of page as you write it. 你通常希望在一个段落中真正长的单词中间看到它,就像你在一个书面段落中用一个长单词连接一样,以便在你编写它时用完页面时将它放在两行上。

As for how to remove it, you can open the web page up using your website editor, locate the tag and simply delete it from the file as you would any other text on a web page when you edit the page normally. 至于如何删除它,您可以使用网站编辑器打开网页,找到标签,只需将其从文件中删除,就像正常编辑页面时网页上的任何其他文本一样。

If you're finding &shy;如果你发现&shy; in your code, I'd recommend leaving it there, especially if it's coupled with a <wbr> tag.在您的代码中,我建议将其保留在那里,尤其是当它与<wbr>标记结合使用时。 See example below:请参阅下面的示例:

**Go full page, then open your console and change the viewport width. **转到整页,然后打开控制台并更改视口宽度。 You'll notice how the word automatically breaks where &shy;你会注意到这个词是如何在&shy;自动断开的&shy; is and adds the hyphen.是并添加连字符。

 <h2>AAAAAAAABBBBBBBCCCCCCCDDDDDDEEE&shy;<wbr>EEEFFFFFFGGGGGGHHHHHHIIIIIIIJJJJJJJ</h2>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM