【问题标题】:css - float right disables linkscss - 向右浮动禁用链接
【发布时间】:2014-05-10 08:20:58
【问题描述】:

当我尝试使它们处于浮动状态时,为什么我的链接会被禁用?

HTML:

<span id="spnLoginRegister">
    <a href="login.htmls" type="text/html">Login</a>
    | 
    <a href="register.html" type="text/html">Register</a>
</span>

CSS:

#spnLoginRegister{
    position: relative;
    right: 0px;
    font-size: 20px;
    margin-top: -10px;
}

-- 或--

#spnLoginRegister{
    float: right;
    font-size: 20px;
    margin-top: -10px;
}

这两种 CSS 方法都禁用链接。然后我删除了float: right; 部分,链接工作得很好。我觉得解决方案很简单,但我只是没有看到它。

这里是网站的链接:http://friendshipodyssey.com/

【问题讨论】:

标签: html css hyperlink css-float broken-links


【解决方案1】:

我看到你的在线页面,你必须删除这个属性:

position: relative;

来自这个 id:

#hgpHeaders

你的问题得到解决。

【讨论】:

  • 修复了它。为什么会这样?
  • 由于位置不正确且不需要 + 您还可以为该元素指定宽度,这将是固定的。
【解决方案2】:

您的代码没有问题: jsfiddle + jsfiddle

请检查您的其他 CSS 代码,最好使用 &lt;span&gt; 标记,如下所示:

<a href="login.htmls" type="text/html"><span>Login</span></a> 

尝试使用&lt;div&gt; 而不是&lt;span&gt;

【讨论】:

    【解决方案3】:

    我已经检查了你的网站,http://friendshipodyssey.com/

    解决办法:

    只需将 span id="spnLoginRegister" & hgroup id="hgpHeaders" 放入 DIV 中,并将 CSS 属性指定为 width: 100% & height:150px,

    同样对于#hgpHeaders,应用CSS 属性float:left。

    希望它能解决你的问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多