0

我在 asp 中有这段代码,其中有一个段落和一个链接。问题是它获得的链接超长,所以它破坏了页面的设计,无论如何让它看起来像一个盒子(就像它有一个换行符一样)。更具体地说,我有一个看起来像这样的链接

http://www.google.com/cewcexxwrfrgregrfref/rferfrefrferfrefrf_jerfreferfrefrefrefrefrefer_freferfwrfwefewfewfwefewfwefefwefewfwefewf909ew0fwefwefwefwefwefwefwefwefewfwefewffwefwefwefwef99we0fwef__________________fwefwefewfewfw45453rwefwef

我希望它看起来与此类似,这样它就不会破坏我的页面。

            http://www.google.com/cewcexxwrfrgregrfref/
            rferfrefrferfrefrf_jerfreferfrefrefrefrefrefer_
            freferfwrfwefewfewfwefewfwefefwefewfwefewf909e
            w0fwefwefwefwefwefwefwefwefewfwefewffwefwefwefwef99we0f
            wef__________________fwefwefewfewfw45453rwefwef

这是代码

 <h4 class="SubTitle">
 Follow our Instructions</h4>
 <p>
   The instructions can be found in several places but we recommend:
     <br />
       <asp:LinkButton ID="lnkUrl" runat="server" Width="100px"></asp:LinkButton>
 </p>
4

3 回答 3

1

使用 CSSword-wrap属性,这样:

a { display: block; word-wrap: break-word; }​

你可以看到它在这里工作。因此,在您的代码中可能是:

<h4 class="SubTitle">Follow our Instructions</h4>
<p>
    The instructions can be found in several places but we recommend:
    <br />
    <asp:LinkButton ID="lnkUrl" runat="server" Style="display: block; word-wrap: break-word; width: 100px;"></asp:LinkButton>
 </p>
于 2012-05-05T23:30:15.460 回答
0

你应该把它放在一个有宽度的 div 中。浏览器会自动为您包装它。

<p>
   The instructions can be found in several places but we recommend:
</p>
<div style="width: 100px;">
<asp:LinkButton ID="lnkUrl" runat="server" Width="100px"></asp:LinkButton>
</div>
于 2012-05-05T23:08:38.987 回答
0
 I think this might work, apply this css class to your link
 <head>
 <style type="text/css">
 .nobreak{display:inline;}
 </style>
 </head>

 <h4 class="SubTitle">
  Follow our Instructions</h4>
  <p>
   The instructions can be found in several places but we recommend:
   <br />
  <asp:LinkButton cssClass="nobreak" ID="lnkUrl" runat="server" Width="100px">    </asp:LinkButton>
</p>
于 2012-05-05T23:18:26.127 回答