简体   繁体   English

在IE中,定位文字溢出/重叠而不是换行,但其他文字没有

[英]In IE, anchor text is overflowing/overlapping instead of wrapping, but not other text

I am running into an annoying problem I have yet to solve. 我遇到了一个尚未解决的烦人的问题。 Before I get too far into this I will point out that I am doing this in Drupal 7 (so no need to comment about the excessive wrapper elements, I already know). 在深入探讨这一点之前,我会指出我正在Drupal 7中进行此操作(因此,我已经知道,无需评论过多的包装器元素)。

The problem is that in all versions of IE (11 and on down) the question text (which are also anchor tags) seems to spill over past the edge of the parent container. 问题在于,在所有版本的IE(11及更低版本)中,问题文本(也是定位标记)似乎溢出了父容器的边缘。 In this case, since it has a top 5 widget box to the right, the text overlaps the widget box. 在这种情况下,由于它在右侧具有前5个小部件框,因此文本与小部件框重叠。

The problem does not seem to happen in any other browsers (at least the rest can mostly get standardization right). 该问题似乎在其他任何浏览器中都没有发生(至少其余浏览器大多数都可以正确实现标准化)。 I have tried setting the parent position relative. 我尝试设置相对的父级位置。 I have tried fiddling with the text-overflow and the word-wrap properties. 我尝试摆弄文本溢出和自动换行属性。 I have tried setting sub-container widths and positioning. 我尝试设置子容器的宽度和位置。

Nothing I have done so far seems to prevent this text overlapping in any version of IE. 到目前为止,我尚未采取任何措施来防止此文本在任何版本的IE中重叠。 I want it to behave in IE as it does in Chrome/Firefox/Safari/etc. 我希望它在IE中像在Chrome / Firefox / Safari / etc中一样表现。

Here is a link to the recreation of this problem (which replicates the issue in IE as I have verified): 这是解决此问题的链接(如我所验证的,该问题在IE中复制了该问题):

http://jsfiddle.net/pthurmond/zn23jvap/1/ http://jsfiddle.net/pthurmond/zn23jvap/1/

The problem is with the ones with long text such as this: 问题是那些带有长文本的文本,例如:

<a class="fieldset-title" href="#">
  <span class="fieldset-legend-prefix element-invisible">Show</span>
  <span>
    <span class="question" url="/someone-used-my-social-security-number-open-credit-card-account-can-i-get-new-social-security-number">
      Someone used my social security number to open a credit card account. Can I get a new social security number?
    </span>
  </span>
</a>

Does anyone have any ideas as how to fix this? 有谁对解决这个问题有任何想法吗?

The issue is caused by the <legend> element. 此问题是由<legend>元素引起的。 There is a bug in Internet Explorer which causes the legend to be displayed without word wrap. Internet Explorer中存在一个错误,该错误导致图例不进行自动换行显示。 See this article for more information. 有关更多信息,请参见本文

I would recommend just using a header tag instead. 我建议只使用标头标记代替。

The <legend> element is wider than its containing element in this document: 在本文档中, <legend>元素比其包含的元素

legend { max-width: 100%; }

This minor change should resolve the issue for you. 这项较小的更改将为您解决问题。

Given that you are portraying a list of questions and answers in this document, I would actually encourage you to consider a different structure, one using <dl> , <dt> , and <dd> instead: 鉴于您正在本文档中描绘一系列问题和答案,因此我实际上鼓励您考虑使用不同的结构,而不是使用<dl><dt><dd>

 <dl> <dt>I placed a fraud alert for myself. Does that cover my spouse as well?</dt> <dd>No. A separate fraud alert must be placed for your spouse. You each..</dd> <dt>Someone used my social security number to open a credit card account.</dt> <dd>It's unlikely the Social Security Administration will issue a new n..</dd> </dl> 

This is precisely the type of content the definition list is designed to accomodate. 这正是定义列表旨在容纳的内容类型。

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

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